scalar(@_) is numbered from 1 to elements... andsub split_array_in_two { my $len = int($#_/2); return unless ( @_ ); return [ @x[0..$len] ], [ @x[$len+1..$#x] ]; }
Your code isnīt long... is readable and suficient.
In reply to Re: split an array in two
by mda2
in thread split an array in two
by water
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |