Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl string manipulation

Reply
Thread Tools

Perl string manipulation

 
 
jared in ecs
Guest
Posts: n/a
 
      10-22-2003
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
 
Reply With Quote
 
 
 
 
Andrew Shitov
Guest
Posts: n/a
 
      10-22-2003
> i tried using :
> $title=~ s/\s//;


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

 
Reply With Quote
 
 
 
 
Roy Johnson
Guest
Posts: n/a
 
      10-22-2003
This newsgroup is defunct. Use comp.lang.perl.misc instead.

(jared in ecs) wrote in message news:<. 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.)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
perl or shell for ip manipulation Dave Perl 1 12-22-2007 12:52 PM
cron manipulation using perl siddhartha mulpuru Perl Misc 4 09-18-2004 12:41 AM
Perl array manipulation questions Bryan Perl Misc 5 05-21-2004 01:10 PM
RE: Perl vs. Python for text manipulation Tim Peters Python 0 01-24-2004 09:38 PM
Direct experience of text manipulation in Perl/TCL? Selwyn Leeke Perl Misc 3 09-15-2003 03:43 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57