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

Re^2: Renaming all files in a directory

by choroba (Archbishop)
on Feb 02, 2021 at 13:44 UTC ( #11127815=note: print w/replies, xml ) Need Help??


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]

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2021-04-10 14:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?