if(defined @$arrayref && @$arrayref) { # do something with @$arrayref like: for my $i (@$arrayref) { print $i; } }