in reply to Create dynamically different array names based on counter incrementation

You want an array of arrays. Something like:
my @array; while (<IN>) { push @array, [extract_data_from_line $_]; }
for some subroutine extract_data_from_line that turns a string into a list of data.

Replies are listed 'Best First'.
Re^2: Create dynamically different array names based on counter incrementation
by happy.barney (Friar) on Jan 21, 2011 at 14:11 UTC
    shorter (and better to read for me)
    my @array = map [extract_data_from_line $_], <IN>;

      This needs twice as much memory, though (temporarily, for building the intermediate list).

      Usually, this won't be an issue, but it might be relevant when dealing with huge arrays, in order to limit peak memory usage.

        This needs twice as much memory, though (temporarily, for building the intermediate list).
        Only if [list of data extracted from line] takes the same amount of memory as the line itself. It's more likely the array takes more memory than the list.
        This needs twice as much memory, though (temporarily, for building the intermediate list).

        No it doesn't. Twice as much would be twice the size of @array