use Data::Dumper; my @p = give(); my $p = give(); print Dumper( \@p , $p ); sub give { # Case of error. return; }