if ( not( $ref ) ) { print "No results\n"; } else { # code to print results } #### my $result = join ", ", @{ $ref }; print $result, "\n";