The first part:
for my $c (1..$data->{n1}) {
Will not be faster by allocating to an intermediate $n1 variable. It may even be a couple of nanoseconds slower.
The second part:
$data->{"exclude-$c-$_"} = 'yes' for 1..$data->{n2};
May be very slightly faster if you assign an intermediate $n2 variable before the outer loop because it prevents a hash lookup for each iteration of the outer loop. However with your n1 being "like 10 or less", this is not likely to make any practical difference in speed. If you were dealing with millions of iterations of the outer loop, it might be worth optimizing.
In reply to Re: does a hash element as a loop parameter cause significant slowdown?
by tobyink
in thread does a hash element as a loop parameter cause significant slowdown?
by misterperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |