print join "\n",@stuff,"\n";
Your code results in a double newline at the end of the string being printed, which might not fit the requirement. Why not use parentheses so that join only operates on @stuff? Or why not make the last item being joined an empty string? Another way would be to modify the default list separator (see $LIST_SEPARATOR or $" in perlvar).
$ perl -e ' > my @stuff = qw{ foo bar baz }; > > print join qq{\n}, @stuff, qq{\n}; > print qq{Tail of test 1\n}; > > print join( qq{\n}, @stuff ), qq{\n}; > print qq{Tail of test 2\n}; > > print join qq{\n}, @stuff, q{}; > print qq{Tail of test 3\n}; > > print do{ local $" = qq{\n}; qq{@stuff\n} }; > print qq{Tail of test 4\n};' foo bar baz Tail of test 1 foo bar baz Tail of test 2 foo bar baz Tail of test 3 foo bar baz Tail of test 4 $
I hope this is of interest.
Cheers,
JohnGG
In reply to Re^2: pipe one function output to another
by johngg
in thread pipe one function output to another
by bob_dobalina
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |