in reply to Identifying duplicates in array or hash based on a subset of data
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; *ARGV = *DATA{IO} unless @ARGV; my (%all, %duplicates); <>; # Skip header. while (<>) { my ($id, $type, $pos) = split; undef @{ $duplicates{$type}{$pos} }{ $id, $all{$type}{$pos} } if exists $all{$type}{$pos}; $all{$type}{$pos} = $id; } say join ' ', 'Duplicates:', join '; ', map { join ', ', map keys %$_, values %$_ } values %duplicates; __DATA__ ID Type Pos 1 1 10 2 1 11 3 1 11 4 1 15 5 2 5 6 2 5 7 2 7
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|