in reply to How to refer to a scalar variable dynamically?
Anytime you think you want to use soft references, look real hard at hashes instead.my %totals = ( login => 0, campaign => 0, work => 0, ); foreach my $func (qw(login campaign work)) { # Do stuff my $tmp = calc_difference($var1, $var2); $totals{$func} += $tmp; }
------
We are the carpenters and bricklayers of the Information Age.
Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.
Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.
|
|---|