Hi Tim,

On Sun, 23 Jun 2013 10:21:58 +0100
timothy adigun <2teezp...@gmail.com> wrote:

> Hi Shlomi,
> 
> 
> On Sun, Jun 23, 2013 at 10:02 AM, Shlomi Fish <shlo...@shlomifish.org>wrote:
> 
> > 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.
> >
>
> ++. You are right. It's a keyword related to the control flow of Perl
> program.
> I mistook it for a function (a.k.a "subroutine") because I could use this
> "perldoc -f last" from CLI.
> Thanks for look out for me... :)

You're welcome. Just for the record, perldoc perlfunc
( http://perldoc.perl.org/perlfunc.html ) documents all other keywords
including "while" and "if" - for completeness sake.

Regards,

        Shlomi Fish

-- 
-----------------------------------------------------------------
Shlomi Fish       http://www.shlomifish.org/
NSA Factoids - http://www.shlomifish.org/humour/bits/facts/NSA/

Buffy will always find a wooden stake to slay vampires, even if it means
she will have travelled 100 years back in time, to plant a tree nearby.
    — http://www.shlomifish.org/humour/bits/facts/Buffy/

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