The values function returns, in random order, an array consisting of all the values of a hash. : values « Hash « Perl






The values function returns, in random order, an array consisting of all the values of a hash.

   

#Format:
#values(ASSOC_ARRAY)
#values ASSOC_ARRAY

# The values function returns the values in a hash
%weekday= (    '1'=>'Monday',
               '2'=>'Tuesday',
               '3'=>'Wednesday',
               '4'=>'Thursday',
               '5'=>'Friday',
               '6'=>'Saturday',
               '7'=>'Sunday',
              );
foreach $value ( values(%weekday)){print "$value";}
print "\n";

   
    
    
  








Related examples in the same category

1.Using values function to get all value in a hash