in reply to Re^6: undef a variable for a loop
in thread undef a variable for a loop
In your second snippet, you still print the last match of the last file, not the last match of each file.
This depends on what is in @completefile, as I previously discussed. I suppose it's also possible the OP wants just one result for all the elements of $exch, in which case the loop nesting should be reversed.
Then why did you proceed by putting the print in an if?
My point was that every iteration should output. If I didn't worry about using warnings, I could have had
foreach my $exch (@exch) { my ($su_adapter, $su_date); foreach (reverse @completefile) { last if ($su_adapter, $su_date) = /^.+\\(.+)_.+\..+?:(.+?)\s-\ +s(.+?)\s.+?\/$exch\s\|.+::(.*Up)\(\)/; } print "Results for $exch: $su_adapter, $su_date\n"; }
which reports the same info with no conditional.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: undef a variable for a loop
by ikegami (Patriarch) on May 15, 2009 at 20:48 UTC |