@input = # not sure where the input is from @list = () # whatever... foreach my $line(@input){ my $parser = new Parse::FixedLength([ map {m/^\d+: (.+) (\d+)/} @list ]); my $hash = $parser->parse($line); # do whatever with $has }