programming-examples/perl/Hash/The values function returns, in random order, an array consisting of all the values of a hash.pl

15 lines
414 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
#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";