Beefy Boxes and Bandwidth Generously Provided by pair Networks vroom
P is for Practical
 
PerlMonks  

Re: Re: File remaing and removal to a subdirectory

by bwana147 (Pilgrim)
on Jul 11, 2001 at 13:30 UTC ( [id://95673]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to Re: File remaing and removal to a subdirectory
in thread File renaming and removal to a subdirectory

albeit untested

Indeed ;-) A couple of things go wrong. @infiles is not initialised, but I guess this is left as an exercise to the OP. No, I really wanted to point out the use of exit, which is not what you want here, IIUC. exit terminates the program however deep you are in nested blocs. By using exit here, you stop the program once the first file has been renamed with a suffix. Instead of that, you want to proceed to the next file.

But next goes to the next iteration of the innermost loop. In our case, that would be the loop on suffices, not on files. So you'll need to use LABELS:
FILE: foreach my $filename (@infiles) { ... if ( -e $ofilename ) { SUFFIX: for (@suffix) { if ( ! -e "$ofilename.$_" ) { ... next FILE; } else { ... } } } else { ... } }

--bwana147

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://95673]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.