in reply to Re: perl -pi -e s'/^\s+//'g $file
in thread perl -pi -e s'/^\s+//'g $file
into a template$ perl -MO=Deparse -p -i.orig -e "s/foo/bar/; ... " BEGIN { $^I = ".orig"; } LINE: while (defined($_ = <ARGV>)) { s/foo/bar/; die 'Unimplemented'; } continue { die "-p destination: $!\n" unless print $_; } -e syntax OK
then turn it into a distribution with scriptdist :D#!/usr/bin/perl -- use strict; use warnings; Main( @ARGV ); exit( 0 ); sub Main { RuinSomeFilesOrig(@_); } sub RuinSomeFilesOrig { local *ARGV; local $^I = ".orig"; local @ARGV = @_; LINE: while (defined($_ = <ARGV>)) { s/foo/bar/; ...; } continue { die "-p destination: $!\n" unless print $_; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: perl -pi -e s'/^\s+//'g $file
by goibhniu (Hermit) on Apr 12, 2011 at 19:12 UTC | |
|
Re^3: perl -pi -e s'/^\s+//'g $file
by Anonymous Monk on Apr 26, 2011 at 11:57 UTC | |
by Anonymous Monk on Mar 22, 2012 at 10:55 UTC | |
by Anonymous Monk on Nov 23, 2012 at 07:34 UTC |