Hi Tim,

just a note.

On Sun, 23 Jun 2013 09:39:48 +0100
timothy adigun <2teezp...@gmail.com> wrote:

> Hi lee,
> Please, check my comment below:
> 
> On Sun, Jun 23, 2013 at 3:43 AM, lee <l...@yun.yagibdah.de> wrote:
> 
> > James Alton <jamesalton...@gmail.com> 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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to