Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: extracting only those keys with uniq values in array list

by hippo (Chancellor)
on Apr 20, 2021 at 14:14 UTC ( #11131514=note: print w/replies, xml ) Need Help??


in reply to extracting only those keys with uniq values in array list

For every key($r_name) , I have 2 values. I want to print the names of those keys($r_name) where the 2 values for a particular key($r_name) are same. If the 2 values for the particular key are different from each other, then I do not want to output that key.
use strict; use warnings; use Test::More tests => 1; my %read2seq = ( foo => [123, 123], bar => [456, 789] ); my @want = ('foo'); my @samevals = grep { $read2seq{$_}->[0] eq $read2seq{$_}->[1] } keys +%read2seq; is_deeply \@samevals, \@want;

🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11131514]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2021-05-13 19:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (142 votes). Check out past polls.

    Notices?