Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Rename File Name in Array

by rhesa (Vicar)
on Jul 20, 2008 at 11:22 UTC ( [id://698911]=note: print w/replies, xml ) Need Help??


in reply to Rename File Name in Array

It "doesn't work", because $ext is reset to "A" on every iteration. You need to declare and initialize that variable outside the loop.

To update $x->[0] after the rename, simply do $x->[0] = "USB" . $ext;.

Replies are listed 'Best First'.
Re^2: Rename File Name in Array
by drodinthe559 (Monk) on Jul 20, 2008 at 11:25 UTC
    Thanks, I knew it was something cheesy.
      Is there anyway to report that the renaming was successful?
        rename ($x->[0], "USB" . $ext) and print "rename was successful.\n";

        (rename returns true for success, false otherwise.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (8)
As of 2024-04-19 09:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found