#!/usr/bin/perl use Win32; use strict; use warnings; use v5.10.10; use Data::Dumper; user constant { DEBUG => 1, } my %hash; my $counter; #hash has stuff put in it here $counter = &compare_hash(\%hash); sub compare_hash{ my $hashRef = shift; my $hash = %$hashRef; my $counter = 0; print Dumper(\%hash); #searching for undef or blank ('') values in the dump output comes up empty print "$_ has undef as value\n" for grep {not defined $hash{$_}} keys %hash #this comes up empty, thanks to Corion for the #suggestion foreach my $key (sort { $hash{$a} cmp $hash{$b} } keys %hash){ #this is line 66 #do something #print and check and stuff on $hash{$key} ++$counter; } return $counter; }