in reply to Split output by tabs
print {$OUT} map "@$_\n", sort { $a->[10] cmp $b->[10] } @out;
Gratuitous use of curlies: sometimes it is necessary to employ a BLOCK returning a file handle, but here it isn't.
Then, - TIMTOWTDI - see the special variable $" in perlvar:
{ local $" = "\t"; print $OUT map "@$_\n", sort { $a->[10] cmp $b->[10] } @out; }
Here, the curlies are necessary to localize the (otherwise global) variable $" to the enclosed block.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Split output by tabs
by perlnoobster (Sexton) on Nov 13, 2012 at 09:35 UTC | |
by shmem (Chancellor) on Nov 13, 2012 at 09:41 UTC | |
by perlnoobster (Sexton) on Nov 13, 2012 at 09:52 UTC | |
by shmem (Chancellor) on Nov 13, 2012 at 10:07 UTC | |
by perlnoobster (Sexton) on Nov 13, 2012 at 10:10 UTC | |
| |
Re^2: Split output by tabs
by choroba (Cardinal) on Nov 13, 2012 at 09:24 UTC | |
by shmem (Chancellor) on Nov 13, 2012 at 09:34 UTC | |
by ColonelPanic (Friar) on Nov 13, 2012 at 11:23 UTC | |
by Anonymous Monk on Nov 13, 2012 at 13:45 UTC | |
by choroba (Cardinal) on Nov 13, 2012 at 13:58 UTC | |
| |
by ColonelPanic (Friar) on Nov 13, 2012 at 14:13 UTC | |
|
In Section
Seekers of Perl Wisdom