PearlsOfWisdom has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
Perl noob here with a distinctly NoobFresh(TM) scented question.... ;-)
Comment out "use strict;" in the below and it all works.... uncomment "use strict" and Perl starts giving me abuse about "Global symbol requires explicit package name".
Help !
#!/usr/bin/perl use strict; %hash = ( ' Key1', ' Value1'); sub doStringTidy { my $string=shift; $string =lc($string); $string=~s/^\s+//; $string=~s/\s+$//; return $string; } sub doHashTidy { my $hash=shift; foreach my $k (keys %{hash}) { $kv=doStringTidy($k); $vv=doStringTidy($hash{$k}); delete $hash->{$k}; $hash{$kv} = $vv; } } doHashTidy(\%hash); foreach my $key ( keys %hash ) { print "key:$key, value:$hash{$key}\n"; }
Back to
Seekers of Perl Wisdom