469,282 Members | 1,704 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,282 developers. It's quick & easy.

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= stumblefromgrace

i tried using :
$title=~ s/\s//;
but it did not seem to work
Jul 19 '05 #1
2 7009
> i tried using :
$title=~ s/\s//;


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

Jul 19 '05 #2
This newsgroup is defunct. Use comp.lang.perl.misc instead.

ja*********@und.nodak.edu (jared in ecs) wrote in message news:<98**************************@posting.google. com>...
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.)
Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

58 posts views Thread by @ | last post: by
9 posts views Thread by Martin Foster | last post: by
3 posts views Thread by DGG | last post: by
reply views Thread by Mark Healey | last post: by
9 posts views Thread by Dieter Vanderelst | last post: by
32 posts views Thread by tshad | last post: by
3 posts views Thread by pc | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.