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"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Strictly frustrating !
by marto (Cardinal) on Jul 26, 2013 at 14:49 UTC | |
by PearlsOfWisdom (Initiate) on Jul 26, 2013 at 14:57 UTC | |
by marto (Cardinal) on Jul 26, 2013 at 15:00 UTC | |
by PearlsOfWisdom (Initiate) on Jul 26, 2013 at 15:08 UTC | |
by derby (Abbot) on Jul 26, 2013 at 17:41 UTC | |
by marinersk (Priest) on Jul 26, 2013 at 16:02 UTC | |
Re: Strictly frustrating !
by Crackers2 (Parson) on Jul 26, 2013 at 15:12 UTC | |
by ramlight (Friar) on Jul 26, 2013 at 15:30 UTC | |
Re: Strictly frustrating !
by marinersk (Priest) on Jul 26, 2013 at 16:00 UTC | |
by PearlsOfWisdom (Initiate) on Jul 26, 2013 at 16:40 UTC | |
by sparkyichi (Deacon) on Jul 26, 2013 at 21:00 UTC | |
Re: Strictly frustrating !
by mtmcc (Hermit) on Jul 26, 2013 at 14:55 UTC |
Back to
Seekers of Perl Wisdom