[EMAIL PROTECTED] wrote:
> hi, perlers,
Hello,
> Is there a simple way to get the current index of an array in loop statement?
> the procondition is you cannot get this information from array element. For
> example
>
> #!usr/bin/perl
> my @arr = qw/a b c d e/;
> for(@arr)
> {
> print "The No.?? element is $_\n";
> }
for ( 0 .. $#arr )
{
print "The No. $_ element is $arr[$_]\n";
}
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>