Gossamer Forum
Home : General : Perl Programming :

Replace blank space with '_'

Quote Reply
Replace blank space with '_'
Hi,

I'm using Links SQL and have a custom script that has the following lines:

{
$clean_name = $row->{'Full_Name'};
$url = qq~$CFG->{build_root_url}/$clean_name/$CFG->{build_index}~;
}

The variable Full_Name comes from the Links SQL Category table, and my problem are the cases where the Full_Name value has spaces. For example:

Category/Sub Category/Another Sub Category

I somehow need it to take the $clean_name variable and then replace any blank spaces with an underscore character so it would be:

Category/Sub_Category/Another_Sub_Category

Does anyone know of a line I could add to the above code that would accomplish this?

--FrankM

Last edited by:

FrankM: Apr 12, 2004, 2:32 PM
Subject Author Views Date
Thread Replace blank space with '_' FrankM 24229 Apr 12, 2004, 2:31 PM
Thread Re: [FrankM] Replace blank space with '_'
FrankM 24064 Apr 12, 2004, 2:52 PM
Thread Re: [FrankM] Replace blank space with '_'
Andy 24102 Apr 13, 2004, 8:32 AM
Post Re: [Andy] Replace blank space with '_'
FrankM 24026 Apr 17, 2004, 2:47 PM