Perl string manipulation

J

jared in ecs

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
 
R

Roy Johnson

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

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

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,109
Messages
2,570,671
Members
47,263
Latest member
SyreetaGru

Latest Threads

Top