in reply to incrementing array name

sub seperate_data {
  push(@{$arrays}, split / /,$data[$a]);
push(@{$arrays}, [split(/ /,$data[$a])]); }
This will give you an array of arrays. $array[0][0] being the first element of your first array and $array[1][0] being the first element of your second array...

Update: How could I miss the brackets? Thanks gjb for showing it.

Update 2 (see below):$array->[0][0] being the first element of your first array and $array->[1][0] being the first element of your second array...

Replies are listed 'Best First'.
Re: Re: incrementing array name
by gjb (Vicar) on Jun 23, 2003 at 12:23 UTC

    Close, but no cookie ;-) I think you want something like this:

    sub seperate_data { push(@{$arrays}, [split(/ /,$data[$a])]); }
    since otherwise you'll end up with a long list rather than a list of lists.

    Hope this helps, -gjb-

      No cookie too ;-) because you missed my second mistake
      .oO( I should never post untested code. At least I'm not Micro$chrott )
      which is: $array->[0][0] will give the first element of the first array...
      When I attempt to: print "$arrays[0][0]"; I'm getting an error that I have an uninitialized value in that line. Any suggestions? Llamo_rin