Home : General : Perl Programming :

General: Perl Programming: Replace blank space with '_': Edit Log

Here is the list of edits for this post
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

Edit Log: