in reply to iterating over array to create smaller arrays based on pattern match
my %sorted; foreach my $item (@array) { my ($prefix) = $item =~ /^(\w+)/; push @{$sorted{$prefix}}, $item; }
Then you can work your way through the list of items for each prefix like this:
foreach my $prefix (keys %sorted) { my @items = @{$sorted{$prefix}}; # do something with @items... }
Does that make sense?
-sam
|
|---|