I wondered if there was a neat way of foreaching through a list of varibles that are names sequentially
There is, but don't do it. That may sound harsh, but use of symbolic variables is almost categorically a bad thing as a certain
Mr. Dominus illustrates in
Why it's stupid to `use a variable as a variable name' (with follow up articles
here and
here).
The alternatives are either creating an array instead of dynamically generating variables, or just use a hash e.g
## using an array
my @calcs = some_function();
for(@calcs[0 .. 3]) { ... }
## using a hash
for my $k (map "calc$_", 1 .. 4) {
do_stuff( $calc{$k} );
...
}
See.
perldata for info on array slicing and the
map docs for info on
map.
HTH
_________
broquaint