kchinger has asked for the wisdom of the Perl Monks concerning the following question:
Thanks in advance.#!/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{$_}} k +eys %hash #this comes up empty, thanks to Corion for the #suggestion foreach my $key (sort { $hash{$a} cmp $hash{$b} } keys %hash){ #th +is is line 66 #do something #print and check and stuff on $hash{$key} ++$counter; } return $counter; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Uninit Value - Hash Value Compare
by choroba (Cardinal) on Nov 05, 2020 at 15:59 UTC | |
by kchinger (Initiate) on Nov 05, 2020 at 16:47 UTC | |
by AnomalousMonk (Archbishop) on Nov 05, 2020 at 18:07 UTC | |
|
Re: Uninit Value - Hash Value Compare
by kchinger (Initiate) on Nov 05, 2020 at 19:54 UTC |