Hashes

The values function

The values function yields a list of all the current values in a given hash. Example:
#!/usr/bin/perl

my %prices = ("shirt"    => 45,
              "pullover" => 90,
              "trousers" => 120,
              "socks"    => 15);
           
my @shekels = values (%prices);

print "PRICES: @shekels\n";
Result:
PRICES: 90 45 15 120

Table of Contents.
Previous | Next.