in reply to Re: How can one sort array elements in different text files?
in thread How can one sort array elements in different text files?
While I use code like that frequently in Perl for "one off" scripts and love Perl for the ability to do it, for demonstrating technique to someone learning the trade there is just too much to unpack to be useful. How about:
... while (@array) { my @part = splice @array, 0, $size; my @lines = map {"$_\n"} @part; my $fileName = sprintf '%s.txt', ++$file; path($fileName)->append(@lines); }
instead?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How can one sort array elements in different text files?
by 1nickt (Canon) on Nov 06, 2019 at 16:04 UTC |