Q:

perl (syntax error) - Global symbol "@arr1" requires explicit package name

I'm getting error with a message "Global symbol "@arr1" requires explicit package name..".
I googled around, and I found out that I need to declare variable with "my".
But in my case, I don't understand why I'm getting erros for this arrays, as I have defined 
my ($arr1, $arr2) = @_;

The error is pointing at:
$#arr1 = $nLen;
$#arr2 = $nLen;

Here is my code:
sub azip{
    my ($arr1, $arr2) = @_;

    if (@$arr1 != @$arr2) {
        print "Arrays \@$arr1 and \@$arr2 are not equal!\n";
        my $nLen; 
        if (@$arr1 > @$arr2) {
            $nLen = @$arr2 - 1;
            $#arr1 = $nLen;
        } 
        else {
            $nLen = @$arr1 - 1;
            $#arr2 = $nLen;
        }
    }
}

A:

As $arr1 is array reference, you might try
$#$arr1 = $nLen; # or $#{ $arr1 }

and
$#$arr2 = $nLen;

