10.6. Fetching data from hash

my @fields = keys %user;
foreach my $field (@fields) {
    print "$field    $user{$field}\n";
}


foreach my $field (keys %user) {
    print "$field    $user{$field}\n";
}


my @fields = keys %user;
my @sorted_fields = sort @fields;
foreach my $field (@sorted_fields) {
    print "$field    $user{$field}\n";
}

foreach my $field (sort keys %user) {
    print "$field    $user{$field}\n";
}

If you are interested in on-site trainings by the author, please contact me directly.

Online courses:

Would you like to get
updated when I publish
the next article?

Follow me:

Google Plus Twitter RSS feed