apomatix has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use strict; grep { NUM: for(0 .. $_) { last NUM if $_ > 3; } } 1 .. 10;
One fix is to put something in front of the label:syntax error at ./test.pl line 4, near "NUM:" syntax error at ./test.pl line 8, near "}" Execution of ./test.pl aborted due to compilation errors.
Is there any way to start the block with a label?#!/usr/bin/perl use strict; grep { 1; NUM: for(0 .. $_) { last NUM if $_ > 3; } } 1 .. 10;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Labels at beginning of a block
by jwkrahn (Abbot) on Aug 19, 2011 at 19:56 UTC | |
|
Re: Labels at beginning of a block
by Anonymous Monk on Aug 20, 2011 at 03:03 UTC |