Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: renaming files...

by plaid (Chaplain)
on Aug 08, 2000 at 22:06 UTC ( #26841=note: print w/replies, xml ) Need Help??


in reply to renaming files...

On the line
if ($TEMP1 =~ /(A-[0-9]+-[0-9]+)/) {
You want to take the output of the pattern match. $TEMP1 isn't being altered at all, it's just being matched against. The result of the pattern match is left in $1. Try this:
$DIR="."; opendir CONCEPT, $DIR || die "no such dir"; while ($TEMP = readdir(CONCEPT)) { if ($TEMP =~ /(A-[0-9]+-[0-9]+)/) { if (rename $TEMP, $1) { print $1; } } }
The code was editted as little as possible. Any stricting, -w'ing, and error checking is left as an excercise to the reader.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (1)
As of 2022-01-19 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (55 votes). Check out past polls.

    Notices?