in reply to foreach count variable

$. does that for the special case of iterating over records from a filehandle.

Update: Ooh! Just made a connection -

my $bar = join $/, @bar; $bar .= $/; open my $foo, '<', \$bar or die $!; while (<$foo>) { print $., ' -> ', $_; } close $foo or die $!;
That will take perl 5.8 to work. Yes, it's much heavier than $count++, but it's a window into a whole 'nother thing. (Added shameless plug) See Open Has a New Trick.

After Compline,
Zaxo