SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: cgi question

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    IL
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    cgi question

    Hi,

    I have a cgi script and i don't realy have a clue in cgi..

    There are variables like $dir_name or $tmp that i use in several places on the cgi page.

    The problem is that some of the values of these variables have underscore (_) inside and i'd like to display the value without the underscore. It means to replace the _ with space.

    For example if the value is "George_W_Bush" it will display "George W Bush".

    Is there a simple way to do it - something like commandname($tmp) ?

    Or a hard way ?

    Please help, Thanks,
    E-A.

  2. #2
    SitePoint Wizard bronze trophy KevinR's Avatar
    Join Date
    Nov 2004
    Location
    Moon Base Alpha
    Posts
    1,053
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    $string = 'George_W_Bush';
    $string =~ tr/_/ /;
    print $string;

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Location
    IL
    Posts
    39
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Worked like a charm

    Thanks !
    E-A.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •