in reply to Arrary of Hashes populating issue

First off, s/^\s+|\s+$//g; isn't doing what you think it's doing, but that's not your problem.

Your problem is that you're making it too difficult for yourself. Either

my @stuff; while (<DATA>) { my @fields = split $Delimiter, $_; my ($type, $name) = $fields[0] =~ /^(...)(.*)/; if ($type eq 'BNA') { # I don't know what other data you want to keep from the BNA l +ine ... push @stuff, { name => $name, products => [], }; next; } # I don't know what you want to do with this, so I'll just keep it + there. push @{$stuff[-1]{products}}, $_; }

Code is untested, but should work just fine.

Being right, does not endow the right to be rude; politeness costs nothing.
Being unknowing, is not the same as being stupid.
Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.