Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^2: TRIM in Perl?

by Anonymous Monk
on Feb 10, 2011 at 10:01 UTC ( [id://887381]=note: print w/replies, xml ) Need Help??


in reply to Re: TRIM in Perl?
in thread TRIM in Perl?

I wanted the same thing I think - remove leading and trailing space, on a per line basis, ignoring newlines. I've just done this and it seems to work, i.e. linecount remains same before and after.
cat test.dat | perl -n -e 'chomp; s/^\s+//; s/\s+$//; print "$_\n";'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://887381]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2024-04-24 21:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found