in reply to Slurping strings from text file and pushing to array?

<> returns a list of lines in list context.

my @content = do { local @ARGV = $file ; <> } ;

Replies are listed 'Best First'.
Re^2: Slurping strings from text file and pushing to array?
by Mad_Mac (Beadle) on Jul 01, 2010 at 21:32 UTC

    Thanks, but wouldn't that put each line of the text file as an element in an array? What I need is each line to be it's own array and each comma separated chunk of text to be an element in one of those arrays.

    Or am I mis-understanding?

      my @lines; @ARGV = $file; while (<>) { my @fields = ...; push @lines, \@fields; }

      @{$lines[0]} is the array for the first line.
      @{$lines[1]} is the array for the second line.
      etc