http://qs1969.pair.com?node_id=11127815


in reply to Re: Renaming all files in a directory -- perl -n -p and empty files oneliner
in thread Renaming all files in a directory

> note that perl -n and perl -p both skip empty files!

They don't, but that part of code is not exposed to us to insert our own code into. Or is it?

#!/usr/bin/perl -n use warnings; use strict; { package File::ShowName; use Tie::Scalar; use parent -norequire => 'Tie::StdScalar'; sub FETCH { print STDERR "Opening ${ $_[0] }.\n"; ${ $_[0] } } } BEGIN { tie $ARGV, 'File::ShowName' } print;

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]