#!/usr/bin/perl -w use strict; use Data::Dumper; my ($user,$password); my $a=0; my %hash1 = map{$a++=>$_}qw/\$user \$password/; #just text my %hash2 = map{$a++=>$_}(\$user, \$password); #real reference print Dumper \%hash1, \%hash2; $user = 234; $password = 'xyz'; print Dumper \%hash1, \%hash2; __END__ $VAR1 = { '1' => '\\$password', '0' => '\\$user' }; $VAR2 = { '3' => \undef, #ref to an undefined val '2' => \undef }; ################# $VAR1 = { '1' => '\\$password', '0' => '\\$user' }; $VAR2 = { '3' => \'xyz', #see changing $user or $password '2' => \234 #did update the hash #because these are real references. };