Perl Monk, Perl Meditation | |
PerlMonks |
Re: Renaming all files in a directory -- perl -n -p and empty files onelinerby Discipulus (Canon) |
on Feb 02, 2021 at 11:35 UTC ( [id://11127809]=note: print w/replies, xml ) | Need Help?? |
hello Aldebaran, you can avoid the oneliner BEGIN block using the Maori-farewell like in perl -M'5; $counter=0' -nle ... But you can avoid the counter at all:
PS you get the filename currently processed in $ARGV so you can play with it:
PPS note that perl -n and perl -p both skip empty files!
PPPS after choroba's nice below response I cant resist to update the title and to try it:
L*
There are no rules, there are no thumbs.. Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
In Section
Meditations
|
|