perl -Mstrict -wE ' my $foo = "bar"; my $baz = [ "qux", "quux" ]; # we have both kinds local $" = "\n"; # change list separator to a newline say ( ref $_ eq "ARRAY" ? "@$_" : $_ ) for ( $foo, $baz ); '