Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

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

by hippo (Bishop)
on Apr 20, 2021 at 14:14 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11131514]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-29 05:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found