nysus has asked for the wisdom of the Perl Monks concerning the following question:
Got this to filter out undefined values indirectly from a hash slice:
my %args = (profile => 'foo'); my %ta = %args{'profile', 'user', 'password'}; %ta = map { $_ => $args{$_} } grep { $args{$_ } } keys %ta;
It works well enough. But in trying to make it a little more concise:
my %args = (profile => 'foo'); %ta = map { $_ => $args{$_} } grep { $args{$_ } } keys %args{'profil +e', 'user', 'password'};
you get an error: Experimental keys on scalar is now forbidden. Is there a good, more perlish way of pulling this off?
$PM = "Perl Monk's";
$MCF = "Most Clueless Friar Abbot Bishop Pontiff Deacon Curate Priest Vicar";
$nysus = $PM . ' ' . $MCF;
Click here if you love Perl Monks
Back to
Seekers of Perl Wisdom