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. Advertisements

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


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

  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. Advertisements

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. Garfield

    String Array Manipulation Problem

    Garfield, Aug 27, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    2,963
    Michael Lang
    Aug 27, 2003
  2. Aaron

    String Manipulation

    Aaron, Dec 31, 2003, in forum: ASP .Net
    Replies:
    3
    Views:
    4,774
    Dave Davidson
    Dec 31, 2003
  3. Dave
    Replies:
    1
    Views:
    2,663
    J├╝rgen Exner
    Dec 22, 2007
  4. Selwyn Leeke
    Replies:
    3
    Views:
    233
    Anno Siegel
    Sep 15, 2003
  5. Bryan

    Perl array manipulation questions

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

    cron manipulation using perl

    siddhartha mulpuru, Sep 17, 2004, in forum: Perl Misc
    Replies:
    4
    Views:
    360
    Gunnar Hjalmarsson
    Sep 18, 2004
  7. Leonard Challis

    Low level data manipulation in Perl

    Leonard Challis, Jan 16, 2005, in forum: Perl Misc
    Replies:
    22
    Views:
    367
  8. Antwerp
    Replies:
    4
    Views:
    209
    Antwerp
    Feb 23, 2005
Loading...