Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^3: Automatic Loop Counter not in perl

by wfsp (Abbot)
on Aug 21, 2007 at 13:41 UTC ( [id://634083]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Automatic Loop Counter not in perl
in thread Automatic Loop Counter not in perl

I'd do it like this
my @array = qw{zero one two}; for my $i (0..$#array){ print qq{$i\t$array[$i]\n}; }

Replies are listed 'Best First'.
Re^4: Automatic Loop Counter not in perl
by ikegami (Patriarch) on Aug 21, 2007 at 14:44 UTC
    And if you really wanted $_:
    my @array = qw{zero one two}; for my $i (0..$#array){ for ($array[$i]) { print qq{$i\t$_\n}; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://634083]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (3)
As of 2024-04-20 01:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found