in reply to incrementing array name

A twist on particle's solution. Instead of saving to an array, you pass in a referance to that array:

sub separate_data { my $array = shift; $array = [ split / /, $data[$a] ]; } my (@array1, @array2, @array3); seperate_data(\@array1); seperate_data(\@array2); seperate_data(\@array3);

----
I wanted to explore how Perl's closures can be manipulated, and ended up creating an object system by accident.
-- Schemer

Note: All code is untested, unless otherwise stated