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 ( #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? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2022-05-29 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (101 votes). Check out past polls.

    Notices?