last; or you can name action and use last name; ABC: foreach ....
last ABC; Wags ;) -----Original Message----- From: Mark Johnson [mailto:[EMAIL PROTECTED]] Sent: Thursday, November 08, 2001 15:37 To: PERL Beginners (E-mail) Subject: how do i bail out early from a foreach loop In C you can "break" out of a for loop and go on to the next series of statments. How do you do this in PERL? sub PrintResults( @results ) { my @results = shift; foreach my $line (@results ) { $line = &Trim( $line ); if( length($line) ) { if( $line =~ /SNMP TrapReceivers/ ) { break; # what's the right way? } } } print( $line ); foreach $line (@results) { $line = &Trim( $line ); if( length($line) ) { print( $line ); } elsif { break; # what's the right way? } } } -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]