Re:C++ has become a scripting language
by prakashk on Wednesday October 16, 2013 @05:56PM
(#6562362)
Perl5 v12 and up:
Perl6:
[EDIT: fixed typo in first example]
[ Parent
| on HN ]
Here's a couple of interesting Perl alternatives:
my @files = map { IO::File->new($_->[0], $_->[1]) || die $! }
([shift, 'r'], [shift, 'w']);
$files[1]->print( sort $files[0]->getlines );
$_->close for @files;
And... use autodie;
open my $out, '>', $ARGV[1];
print {$out} sort do {open my $in, '<', $ARGV[0]; <$in>};