in reply to How to refer to a scalar variable dynamically?

You may want to use hash in this case.
Store functions as 'keys' and totals as 'values'
my %total; foreach my $function (qw(login campaign work)){ # do some things my $tmp = calc_difference($var1, $var2); $total{$function} += $tmp; } foreach my $function ( keys %total){ print "$function =>",$total{$function},"\n"; } #Single function print $total{login};
artist