[Purdue-pm] Why does this work?

Bradley Andersen bradley.d.andersen at gmail.com
Wed Apr 4 13:33:25 PDT 2012


everyone seems to have missed that i replied already that i turned on my
brain and figured it out :)



On Wed, Apr 4, 2012 at 4:32 PM, Mark Senn <mark at ecn.purdue.edu> wrote:

>    Bradley Andersen wrote:
>    > #!/usr/bin/env perl
>    >
>    > use strict;
>    > use warnings;
>    >
>    > use feature 'say';
>     >
>    > for my $i(1 .. 10) {;
>     >     say $i;
>     > }
>    >
>    > ?? Why does that work?
>
> From "http://perldoc.perl.org/perlsyn.html":
>    The foreach keyword is actually a synonym for the for keyword,
>    so you can use foreach for readability or for for brevity.
>
> The "{;" doesn't cause problems because the statement between
> "{" and ";" is zero length and zero length statements are allowed.
> This code works fine
>    ;;;;;
>    say 'hello'
>    ;;;;;
>
> -mark
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/purdue-pm/attachments/20120404/d3caf4e8/attachment.html>


More information about the Purdue-pm mailing list