#!/usr/bin/env perl # # allcharstwice - print the lines on which each character occurs exactly twice # # $Id: allcharstwice 663 2009-10-01 19:10:51Z rp $ # # Example of use: words -x * | grep '[aeiuo']' | uniqer | allcharstwice use warnings; use strict; while (<>) { /\S.*\S/ or next; my %occ; map { ++$occ{$_} } split( //, $& ); if ( !grep { $_ ne 2 } values %occ ) { print; } }