#!/usr/bin/perl use strict; use warnings; my %data; while () { chomp; my ($team, @field) = split; push @{ $data{$team} }, \@field; }