#!/usr/bin/perl -w my @words; my $line; open (DICT, "< final.txt"); @words= ; close (DICT); foreach $line(@words) { if ($line =~ /s.*h/i) { if ( ($line =~ /s.*s/i) || ($line =~ /h.*h/i) ) { next; } print $line; } } exit; #### asthmatic asthmatical asthmatically asthmatoid asthmogenic asthore asthorin astrachan astrakhan astraphobia astraphobic astrapophobia astrochronological ... crystallographically crystallography crystallophyllian crystograph ctesiphon cubbish cubbishly cuemanship cuish cultish cultishly culture shock cumshaw cunctatorship cuneoscaphoid cuproscheelite curateship curatorship curiosity killed the cat