[Israel.pm] C style for loop

Yossi Itzkovich Yossi.Itzkovich at ecitele.com
Sat Feb 25 12:14:51 PST 2012


This solution makes it run slower, isn't it ?  Since Perl has to use access-by-index, isn't it ?

From: perl-bounces at perl.org.il [perl-bounces at perl.org.il] On Behalf Of sawyer x [xsawyerx at gmail.com]
Sent: Friday, February 24, 2012 10:01 AM
To: Perl in Israel
Subject: Re: [Israel.pm] C style for loop

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

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

foreach my $idx ( 0 .. $#array ) {
     print $array[$idx], "\n";

This e-mail message is intended for the recipient only and contains information which is CONFIDENTIAL and which may be proprietary to ECI Telecom. If you have received this transmission in error, please inform us by e-mail, phone or fax, and then delete the original and all copies thereof.

More information about the Perl mailing list