my $format = join '', map { "A$_" } 3, # Player number 21, # Player name 4, # G 4, # A 6, # +/- 5, # S 6, # PIM 6, # MIN 6, # MAJ 5, # 10 5, # GM 5, # GR 5, # MT 6, # PPG 6, # SHG 6, # GWG 6, # OTG 6, # UAG 6, # ENG 5; # FG while (<$fh>) { next unless /^\d+\s/; # Skip headers. my @record = unpack($format, $_); # Parse data. $record[4] =~ s/^\s+//; # Fix "+/-" formatting. $sth->execute(@record); # Add data to the database. }