Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Renaming all files in a directory

by choroba (Cardinal)
on Feb 02, 2021 at 13:44 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11127815]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-19 14:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found