#!/usr/bin/perl -w use strict; use Data::Dumper; my %hash = (Matt => 24, Dana => 19, Eric => 28, Sara => 20, John => 17, Mike => 23,); print Dumper \%hash; my @sort = sort {$hash{$a} <=> $hash{$b}} keys %hash; my $temp = $hash{$sort[scalar @sort - 1]}; $hash{$sort[scalar @sort - 1]} = $hash{$sort[0]}; $hash{$sort[0]} = $temp; print Dumper \%hash;