Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Rename File Name in Array

by rhesa (Vicar)
on Jul 20, 2008 at 11:22 UTC ( #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
Node Status?
node history
Node Type: note [id://698911]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2020-09-20 07:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (120 votes). Check out past polls.

    Notices?