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

Re: Adding scalars but with a twist..

by holli (Abbot)
on Feb 13, 2005 at 09:53 UTC ( [id://430560]=note: print w/replies, xml ) Need Help??


in reply to Adding scalars but with a twist..

This can easily be done using eval(), even under strict:
use strict; my $a1 = 3; my $a2 = 4; my $a3 = 5; my $sum = 0; for ( 1..3 ) { eval "\$sum += \$a$_"; } print $sum;
p.s.
i personally would prefer to rewrite the script you have to update (as stated in previous post), because not doing so is false lazyness in my eyes.
holli, /regexed monk/

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-24 02:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found