my $diff= easy( \@a, \@b ); foreach ( @$diff ) { my( $same, $aMin, $aMax, $bMin, $bMax )= @$_; ... # rest of code snipped because unaltered }