in reply to Re: Open in for loop/array structure
in thread Open in for loop/array structure

jw, Thanks for the suggestion, I'll put it in and give it a shot see how it works. It's pretty much guaranteed to be "better" than what I've got, in terms of concise-ness and "correctness" or whatever. Thanks for taking the time to help me out, it's really appreciated!

~Jack

Update ... I put it in and ran, and it ran beautifully. One question, if you can give me a pointer. In filling the @FN array, you use the map command and the $_ character, I think I understand that alright, but why did you have to put the first chunk of numbers in single quotes (i.e. '00 .. '18'), but not the rest of them? Is either convention acceptable or is there something specific here?

Also, in the for loop, is it automatic convention that if an array with a scalar name before it (in this case calling $filename in the loop, with the looping parameter being @FN) is accessed, the length of the loop is the length of the array, and the scalar is automatically updated to be each member of the array, starting at 0 and going to the last array point? Does that make sense or is it too wordy?

Just trying to understand exactly how in the for loop, the code knows to use each name in the array. Thanks again!

~Jack

Replies are listed 'Best First'.
Re^3: Open in for loop/array structure
by jwkrahn (Abbot) on Jun 03, 2008 at 20:52 UTC
    why did you have to put the first chunk of numbers in single quotes (i.e. '00' .. '18'), but not the rest of them?

    I used the quotes because without them perl would remove the leading zeros.

    how in the for loop, the code knows to use each name in the array.

    That is the way that for/foreach loops work.