Skip to content

Perl: Hash variables

my %desc;

This lets perl know that you plan on using a hash with the name desc.

$desc{"key1"} = "data for key 1"

Adds the value data for key 1 into the hash desc, with a key key1.

Environment variables are passed to perl via the ENV hash. The example below lists all environment variables

foreach $key (sort keys %ENV) {
print "$key = $ENV{$key}\n";
}