in reply to Scalar vs. array context w/ join()
I dropped OUT , because it doesn't matter if we are using STDOUT or another handle. So, the first line prints out "3" while the second line prints out the elements of $columns joined by tabs.my $columns = [ qw (one two three) ]; # sample data is GOOD print join "\t",@{$columns}. "\n"; print join ("\t",@{$columns}). "\n";
What happened to the first line? Precendance my friend, the dot causes @{$columns} to be evaluated in scalar context, leaving join only one element to well, join: "3\n".
That's why i like to use a comma instead:
print join "\t",@{$columns}, "\n";
jeffa
L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: (jeffa) Re: Not really obfuscation, but.....
by blakem (Monsignor) on Nov 14, 2001 at 23:40 UTC | |
|
(tye)Re2: Not really obfuscation, but.....
by tye (Sage) on Nov 15, 2001 at 02:12 UTC |