[Israel.pm] C style for loop

sawyer x xsawyerx at gmail.com
Fri Feb 24 00:01:59 PST 2012


On Fri, Feb 24, 2012 at 9:41 AM, Stefan Hornburg (Racke)
<racke at linuxia.de>wrote:

>
> How do you write for loops without C-style where you need a running
> index inside the loop code?
>

Simple:
foreach my $idx ( 0 .. $#array ) {
     print $array[$idx], "\n";
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.perl.org.il/pipermail/perl/attachments/20120224/c8c8c6fd/attachment.htm 


More information about the Perl mailing list