On Fri, Jun 15, 2012 at 10:29 AM, Rothenmaier, Deane
<deane.rothenma...@walgreens.com> wrote:
> Yes, it’s Yet Another Noob Question, but the Camel stands mute…
>
>
>
> Is there a way of limiting keys()?  I want to change some values in a hash,
> the values to change or not depending on the value of their keys.
>
>
>
> I.e.:
>
> my %hash = ( 1 => “first”,
>
>                             2 => “second”,
>
>                             3 => “third”,
>
>                             4 => “fourth”,);
>
>
>
> and I want to change the values for 2 and 3 to “zweite” and “dritte”.
>
>
>
> The actual (sort of) line I’m working on is:
>
>
>
> map { $florida_keys{$_} =~ s{/Fred/}{/Barney/} if $_ >= 124 } keys(
> %florida_keys );

I am not sure if this is what you meant, but have you tried grep?

map { $florida_keys{$_} =~ s{/Fred/}{/Barney/} grep { $_ >= 124 } keys(
 %florida_keys );

Check http://perldoc.perl.org/functions/grep.html

regards
   Gabor

-- 
Gabor Szabo                     http://szabgab.com/
Perl Maven                       http://perlmaven.com/
Perl Weekly                       http://perlweekly.com/
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to