in reply to Reading Input from files and separating them into arrays.
If you're separating your data by --, you don't even need the size information.
use Data::Dumper; use strict; my @array; my $i = 0; while (<DATA>) { chomp; # Skip header row if (!$i++) { next; # End of Data Structure. } elsif (/^-*$/) { print Dumper(\@array); @array = (); $i = 0; # Add to data } else { push @array, [split / /]; } } print Dumper(\@array); __DATA__ 3 3 3 6 5 2 4 5 1 5 7 -- 2 4 1 4 5 9 3 8 6 8 -- 5 3 1 5 3 7 3 6 4 7 9 1 2 3 5 7 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
| A reply falls below the community's threshold of quality. You may see it by logging in. |