Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Removing leading whitespace from a file?

by Juerd (Abbot)
on Jul 09, 2002 at 05:44 UTC ( #180419=note: print w/ replies, xml ) Need Help??

in reply to Removing leading whitespace from a file?

An alternative:

use Tie::File; tie @file, 'Tie::File', 'test.txt'; s/^\s+// for @file;
Not the most efficient solution, but I'd prefer it to setting $^I, if it were in a larger program.

The easiest solution was already mentioned:

perl -i -pe's/^\s+//' test.txt

- Yes, I reinvent wheels.
- Spam: Visit eurotraQ.

Comment on Re: Removing leading whitespace from a file?
Select or Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2016-02-08 07:01 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (268 votes), past polls