Hi Tim, just a note.
On Sun, 23 Jun 2013 09:39:48 +0100 timothy adigun <[email protected]> wrote: > Hi lee, > Please, check my comment below: > > On Sun, Jun 23, 2013 at 3:43 AM, lee <[email protected]> wrote: > > > James Alton <[email protected]> writes: > > > > > lee, > > > > > > You have a post statement if and then a code block. You can only use one > > of > > > two forms: > > > > > > print "test" if $color eq "blue"; #no parenthesis required > > > if($color eq "blue"){print "test";} > > > > ++ > > > And I can't have 'last if $color eq "blue" print "test\n";'? That would > > be something quite natural and a logical thing to do ... > > > > logical? How is that? Wrap up, the function 'print' and 'last' in the if > statement like so: > if( $color eq "blue"){ > print "test\n"; > last LABEL; > } > NOTE: That when last is used the loop in question is immediately exits > and execution start at the LABEL statement if provided. So any code after > the last function is not disregarded. > "last" is not a function (a.k.a "subroutine") - it cannot be. It is a special statement which is handled in a special way by the Perl interpreter. "redo" and "next" are not functions either for a similar reason. Regards, Shlomi Fish -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Selina Mandrake - The Slayer (Buffy parody) - http://shlom.in/selina You can never truly appreciate The Gilmore Girls until you’ve watched it in the original Klingon. Please reply to list if it's a mailing list post - http://shlom.in/reply . -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
