use strict; use warnings; use Data::Dumper; my @bsp = ( "a b 3 4 eins.txt", "c d 7 2 zwei.txt", "e f 4 4 drei.txt" ); my %hash = map { my( $Zahl, $andereZahl, $name ) = /(\d+)\s+(\d+)\s+(.+)\.txt$/; $name => [$Zahl, $andereZahl]; } @bsp; print Dumper(\%hash);