in reply to getting out of a loop
It is hard to tell from that. Assuming you've somehow bound $x to $sth, you are printing it outside the loop not inside. The last is going to break out of the loop and goto the print statment, but $x is still defined so it will be printed.
while ( $sth->fetch() ) { chomp $x; last if ( $x =~ /^foo/ ); print "$x\n"; }
More importantly though. Why arn't you letting your DB pull out the ones that start with foo and get rid of them?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: getting out of a loop
by o2bwise (Scribe) on Jun 16, 2006 at 20:14 UTC | |
by eric256 (Parson) on Jun 16, 2006 at 21:18 UTC | |
by o2bwise (Scribe) on Jun 16, 2006 at 21:49 UTC | |
by o2bwise (Scribe) on Jun 17, 2006 at 01:40 UTC | |
by Argel (Prior) on Jun 16, 2006 at 20:32 UTC | |
by o2bwise (Scribe) on Jun 16, 2006 at 21:51 UTC |