in reply to How can one sort array elements in different text files?
Hi, see Path::Tiny for file handling and splice for chopping chunks off an array.
use strict; use warnings; use feature 'say'; use Path::Tiny; my @array = ('a'..'i'); my $size = 2; my $file = 0; path( sprintf('%s.txt', ++$file) )->append( map {"$_\n"} splice(@array +, 0, $size) ) while @array; say "$file files"; __END__
Hope this helps!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How can one sort array elements in different text files?
by GrandFather (Saint) on Nov 06, 2019 at 01:57 UTC | |
by 1nickt (Canon) on Nov 06, 2019 at 16:04 UTC | |
|
Re^2: How can one sort array elements in different text files?
by supriyoch_2008 (Monk) on Nov 06, 2019 at 07:32 UTC |