How to convert spaces into hyphens - PERL

Discussion in 'Programming' started by unknown888, Jul 5, 2006.

  1. #1
    hi, could some one teach me how to convert spaces into hyphens

    let us say

    $a = "testing with internet" and I would like to have $a as "testing-with-internet".
     
    unknown888, Jul 5, 2006 IP
  2. FeelLikeANut

    FeelLikeANut Peon

    Messages:
    330
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #2
    $a =~ tr/ /-/;
     
    FeelLikeANut, Jul 5, 2006 IP
  3. unknown888

    unknown888 Guest

    Messages:
    234
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you very much
     
    unknown888, Jul 5, 2006 IP