Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: Pearls (not really) of Perl programming

by revdiablo (Prior)
on Nov 24, 2004 at 21:17 UTC ( #410250=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Pearls (not really) of Perl programming
in thread Pearls (not really) of Perl programming

Your good reason has a corollary, which happens to be another good reason to use the original code. This modifies the original array:

@array = 1 .. 10; for my $var (@array) { $var++; print "$var\n"; } print "@array\n";

But this does not:

@array = 1 .. 10; for (@array) { my $var = $_; $var++; print "$var\n"; } print "@array\n";


Comment on Re^3: Pearls (not really) of Perl programming
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2015-05-29 04:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    In my home, the TV remote control is ...









    Results (574 votes), past polls