And just to be pedantic, dont forget $#var... eg:<div><br></div><div>my @list;</div><div>foreach (0..$#list) ...</div><div><br></div><div>regards,</div><div>Mathew Robertson<br><br><div class="gmail_quote">On 17 November 2010 10:22, <span dir="ltr"><<a href="mailto:wigs@stirfried.org">wigs@stirfried.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Mon, Nov 15, 2010 at 05:09:33PM +1100, Alec Clews wrote:<br>
> [1] That was a lie. As a special case Perl will look at the line and use<br>
> any flags it sees.<br>
<br>
</div>Just like English there are always exceptions to rules in Perl. There is at<br>
least one other special case where perl does not ignore lines starting with a<br>
'#'. Specifically, the '#line' pragma.<br>
<br>
This tells the perl compiler to reset the source-code line counter. For<br>
example:<br>
<br>
01 #!/bin/env perl -p<br>
02 use strict;<br>
03<br>
04 #line 1001<br>
05 my $x = 2;<br>
05 $m = 1;<br>
<br>
If you run that code an error will be reported in line 1002, and not line 5 as<br>
you would otherwise expect.<br>
<font color="#888888"><br>
--<br>
Wigs<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Melbourne-pm mailing list<br>
<a href="mailto:Melbourne-pm@pm.org">Melbourne-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/melbourne-pm" target="_blank">http://mail.pm.org/mailman/listinfo/melbourne-pm</a><br>
</div></div></blockquote></div><br></div>