I think you want an Array of Arrays (AoA). Read about them in perldsc and perlref.
YuckFoo
Here is one way to go:
#!/usr/bin/perl use strict; use Data::Dumper; my @parts = ([]); while (my $line = <DATA>) { chomp $line; if ($line =~ /^\d-\d\d-ABC\d\d/) { push (@parts, []); } push (@{$parts[-1]}, $line) } print Dumper \@parts; __DATA__ 1-11-ABC22 (12:12) ABC 12 Foo Bar Foo Bar Foo Bar Foo Bar 2-15-ABC33 (12:12) ABC 12 Foo Bar Foo Bar Foo Bar Foo Bar -- 1-11-ABC33 (12:12) ABC 12 Foo Bar Foo Bar Foo bar Foo Bar -- 1-11-ABC33 (12:12) ABC 12 Foo Bar Foo Bar Foo abr Foo bar Foo Bar Foo Bar Foo Bar -- 2-15-ABC45 (12:12) ABC 12 Foo Bar Foo Bar Foo Bar Foo Bar 3-33-ABC15 (12:12) ABC 12 Foo Bar Foo Bar
In reply to Re: Help Parsing a Text File
by YuckFoo
in thread Help Parsing a Text File
by PrimeLord
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |