Perl string manipulation

Discussion in 'Perl' started by jared in ecs, Oct 22, 2003.

  1. jared in ecs

    jared in ecs Guest

    Anyone who can help?

    I need to get rid of the spaces from the contents of a varible.

    example:
    $title= stumble from grace //after it was extracted from afile using substitution

    i need it to be like:
    $title= stumblefromgrace

    i tried using :
    $title=~ s/\s//;
    but it did not seem to work
     
    jared in ecs, Oct 22, 2003
    #1
    1. Advertising

  2. > i tried using :
    > $title=~ s/\s//;


    $title =~ s/\s//g;
     
    Andrew Shitov, Oct 22, 2003
    #2
    1. Advertising

  3. jared in ecs

    Roy Johnson Guest

    This newsgroup is defunct. Use comp.lang.perl.misc instead.

    (jared in ecs) wrote in message news:<>...
    > I need to get rid of the spaces from the contents of a varible.


    tr/ //d;

    (This will leave tabs, newlines, and carriage returns alone, only removing spaces.)
     
    Roy Johnson, Oct 22, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tim Peters
    Replies:
    0
    Views:
    518
    Tim Peters
    Jan 24, 2004
  2. Dave
    Replies:
    1
    Views:
    2,567
    J├╝rgen Exner
    Dec 22, 2007
  3. Selwyn Leeke
    Replies:
    3
    Views:
    147
    Anno Siegel
    Sep 15, 2003
  4. Bryan

    Perl array manipulation questions

    Bryan, May 20, 2004, in forum: Perl Misc
    Replies:
    5
    Views:
    163
    Web Surfer
    May 21, 2004
  5. siddhartha mulpuru

    cron manipulation using perl

    siddhartha mulpuru, Sep 17, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    170
    Gunnar Hjalmarsson
    Sep 18, 2004
Loading...

Share This Page