programming-examples/perl/Hash/Display the list of values.pl

11 lines
344 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
%presidents = ( George => "Washington",
Abe => "Lincoln",
Thomas => "Jefferson",
Harry => "Truman" );
# obtain the list of keys and display each key-value pair
@keys = keys( %presidents );
@values = values( %presidents );
print "\nThe values of the hash are:\n@values\n\n";