foreach (@temp) { sub($x0, $y0, $x1, $y1, @temp) } } #### foreach my $key (keys %other_hash) { # foreach (@{$other_hash{$key}} # { for (my $i=0; $i<=@{$points_by_name{$key}}-4; $i+=2) { innerloop( @{$other_hash{$key}}[$i..$i+3] ); } # } } #### sub innerloop { my ($x2,$y2,$x3,$y3)= @_; foreach my $key (keys %points_by_name) { # foreach (@{$points_by_name{$key}} # { for (my $i=0; $i<=@{$points_by_name{$key}}-4; $i+=2) { sub(@{$points_by_name{$key}}[$i..$i+3], $x2, $y2, $x3, $y3) } # } } }