Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: perl -pi -e s'/^\s+//'g $file

by duelafn (Parson)
on Apr 08, 2011 at 02:57 UTC ( [id://898244]=note: print w/replies, xml ) Need Help??


in reply to perl -pi -e s'/^\s+//'g $file

That is why we have subroutines:

sub pie(&@) { my ($cb, $file) = @_; rename $file, "$file~" or die "Error backing up $file: $!"; open my $IN, "<", "$file~" or die "Error reading $file~: $!"; open my $OUT, ">", $file or die "Error writing $file: $!"; local $_; while (defined( $_ = <$IN> )) { $cb->(); print $OUT $_; } } pie { s/^\s+// } "myfile.txt";

Good Day,
    Dean

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-24 03:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found