use Data::Dumper; my %playerinfo; if ($logline =~ m{ ^ /ip/ ([^/]+) /nickname/ ([^/]+) /wasanderes/ ([^/]+) }x) { my ($ip, $nick, $wasanderes) = ($1, $2, $3); $playerinfo{$nick} = { ip => $ip, wasanderes => $wasanderes, }; } print Dumper \%playerinfo;