in reply to Re: Assign value
in thread Assign value

Note that the statement
    map { $hash{$_} } keys %hash;
produces exactly the same list as
    values %hash;

Replies are listed 'Best First'.
Re^3: Assign value
by bichonfrise74 (Vicar) on Nov 04, 2009 at 20:41 UTC
    Thanks. I was thinking about what the keyword for 'values' was but just totally forgot about it. Anyway, thanks again.
      #!/usr/bin/perl use strict; use warnings; my $names; my %names; while(<DATA>){ if(/{(.*)}/){ $names = $1; print $names; } } __DATA__ {NAME} {AGE} {SEX} {ADDRESS}
      While printing the $names,
      The values should be John 35 M USA.
      The values are not present in the input.
      So i have to create a hash map and assign the values.