On Monday, Nov 17, 2003, at 09:04 US/Pacific, Jeff 'japhy' Pinyan wrote: [..]
which only reads ONE line at a time, whereas
for (<FILE>) { ... }
reads ALL the lines of the file at once, into a list.
really good point there.
but wouldn't the position been just a tad stronger had you noted that the above is similar to
my @file_lines = <FILE>;
and that the traditional
while (<FILE>) { ... }
form is used so as not to require all of the memory that would come from 'sucking in the whole file' to an array.
so a simple general rule would be that the 'for' and in particular the
foreach my $token (@list) {
}
construct is a good list iterator, while 'while' is for not just list iterating...
not a great mneomic, it does have some irony in it.
ciao drieux
---
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]