sub gethash{ foreach(...){ ....... ....... $hash1{$key} = $wert; $hash2{$key} = $wert; } return(%hash1, %hash2); } my(%hash1, %hash2) = &gethash;