Perl string manipulation

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jared in ecs

    Perl string manipulation

    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= stumblefromgrac e

    i tried using :
    $title=~ s/\s//;
    but it did not seem to work
  • Andrew Shitov

    #2
    Re: Perl string manipulation

    > i tried using :[color=blue]
    > $title=~ s/\s//;[/color]

    $title =~ s/\s//g;

    Comment

    • Roy Johnson

      #3
      Re: Perl string manipulation

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

      jared_zubke@und .nodak.edu (jared in ecs) wrote in message news:<9858258e. 0310212215.7a23 03d5@posting.go ogle.com>...[color=blue]
      > I need to get rid of the spaces from the contents of a varible.[/color]

      tr/ //d;

      (This will leave tabs, newlines, and carriage returns alone, only removing spaces.)

      Comment

      Working...