> On Mon, 5 Jul 1999, Edward M. Perry wrote: > > > The intent wasn't too bad, but the execution was indeed poor. > > Once simplified, it makes for solid, readable code. > > I use this a lot. Now about those variable names... > > > > while (!$bFound && @aListOfOldAceFiles) { > > $szOldAceFile = shift @aListOfOldAceFiles; > > $bFound = bCheckIfThisIsAnAceFile($szOldAceFile) > > } > > foreach my $oldfile (@oldfiles) { > ($found=1,last) if isacefile($oldfile); > } > Haven't tested it, but that would be okay, right? It feels more Perlish to > me. I haven't looked at the original code; all that Windows stuff brought > back some painful memories, and I averted my eyes. I don't know, untested code... here??? > Actually, if the "if ($found) {...}" construct was short enough, I might > have been tempted to combine all that crud into: > > foreach my $oldfile (@oldfiles) { > if (isacefile($oldfile) { > # stuff > last; > } > } > > I really don't know why someone would want to mangle the array in this > kind of loop, with the shift stuff. It might even perform worse than a > foreach... One might want to mangle the array if every element is going to be processed. Next time through the loop can pick up where the previous iteration left off. The original problem didn't state that but it might be the case since the solution included it. Any clever ways to hold your place in an array without mangling it (besides an index of course, that might be considered non-perlish). ==== Want to unsubscribe from Fun With Perl? Well, if you insist... ==== Send email to <fwp-request@technofile.org> with message _body_ ==== unsubscribe