my %outputFiles; sub setOutputFile { my ($id,$path,$type) = @_; # HoH method: $outputFiles{$id}{path} = $path; $outputFiles{$id}{type} = $type; # or, simple hash method: # $outputFiles{$id} = join "=:=", $type, $path; } sub getOutputFiles { my $id = shift; # HoH method: my $type = $outputFiles{$id}{type}; my $path = $outputFiles{$id}{path}; # or, simple hash method: # my ( $type, $path ) = split /=:=/, $outputFiles{$id}; # ... do something with $path and $type ... }