PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: " at Frederico Mactal Pedregosa -PRA at " <pedregf at prasol dot com>
Subject: RE: break statement
Date: Oct 13 1997 4:05PM

Try using 

	last 

instead of 

	break

break is for C...

> From owner-sybperl-l@trln.lib.unc.edu Mon Oct 13 10:55 CDT 1997
> X-ListName: SybPerl Discussion List 
> Warnings-To: <>
> Sender: owner-sybperl-l@trln.lib.unc.edu
> From: "Marcotte, Lawrence" 
> Reply-To: SYBPERL-L@trln.lib.unc.edu
> To: "'SYBPERL-L@trln.lib.unc.edu'" 
> Subject: RE: break statement
> Date: Mon, 13 Oct 1997 11:04:12 -0400
> MIME-Version: 1.0
> Content-Type> : > text/plain> 
> Content-Length: 766
> 
> There is no break statement in Perl.  Look up the last statement
> 
> On Monday, October 13, 1997 9:06 AM, Gayatri Krishnan
> [SMTP:gayatri@ml.com] wrote:
> > Hi,
> > 	Can someone help me with the 'break statement with in a
> 'foreach'
> > loop???
> > 
> > 	I've an array @a with numbers (123, 124, 125)
> > 	
> > 
> >                     foreach $i (0 .. $#a) {  
> > 			 if ($e[$i] == "123") {
> >                 		$code = "A";
> >         		}
> > 			 elsif ($e[$i] == "124") {
> >                 		$code = "B";
> > 				break;
> >         		}
> >              		elsif ($e[$i] == "125") {
> >                 		$code = "C";
> >         		}
> > 		    }
> > 
> > 	Problem is the loop doesn't break when 'a' is 124... instead it
> goes
> > thru all the conditions and $code gets assigned C.
> > 
> > 
> > Thanks!
> > 
> > gayatri
>