[Melbourne-pm] The magic of shebang (was Re: programming tutorials: Perl)
mathew.blair.robertson at gmail.com
Tue Nov 16 15:34:48 PST 2010
And just to be pedantic, dont forget $#var... eg:
foreach (0..$#list) ...
On 17 November 2010 10:22, <wigs at stirfried.org> wrote:
> On Mon, Nov 15, 2010 at 05:09:33PM +1100, Alec Clews wrote:
> >  That was a lie. As a special case Perl will look at the line and use
> > any flags it sees.
> Just like English there are always exceptions to rules in Perl. There is
> least one other special case where perl does not ignore lines starting with
> '#'. Specifically, the '#line' pragma.
> This tells the perl compiler to reset the source-code line counter. For
> 01 #!/bin/env perl -p
> 02 use strict;
> 04 #line 1001
> 05 my $x = 2;
> 05 $m = 1;
> If you run that code an error will be reported in line 1002, and not line 5
> you would otherwise expect.
> Melbourne-pm mailing list
> Melbourne-pm at pm.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Melbourne-pm