Thread Teil-Hash mit Grep auf Keys?
(4 answers)
Opened by LanX- at 2008-10-23 04:59
wenns derselbe hash sein darf:
Code (perl): (dl
)
delete @hash{ grep !m/a/, keys %hash }; wenn nicht: Code (perl): (dl
)
my %hash2 = map { m/a/ ? ($_, $hash{$_}) : () } keys %hash; Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. -- Damian Conway in "Perl Best Practices"
lesen: Wie frage ich & perlintro brian's Leitfaden für jedes Perl-Problem |