sub without_regexp { my $largest = ""; #create my set my %set = ( ); foreach (qw( y h n u j m i k o l p )) { $set{$_} = 1; } #open file, and for every word that is input, if it's #longer than the current longest, for every character, if #it is in the set, jump out, otherwise, if all characters #are NOT in the set (the word had none of the offending #letters), then make it the largest... open (INFILE, ") { chomp; if (length($_) > length $largest) { if (! scalar grep { $set{$_} } split('', lc($_))) { $largest = $_; } } } close (INFILE) || die "error $!"; print "LARGEST FOUND: $largest\n"; } #### sub with_regexp { my $largest = ""; #for every line in the file, if it's length is greater #than the current longest, and it matches the set that #is all of the caracters in the RIGHT hand, not'ed, then #it is the largest open (INFILE, ") { chomp; if (length($_) > length $largest) { if (/[^yhnujmikolp]/i) { $largest = $_; } } } close (INFILE) || die "error $!"; print "LARGEST FOUND: $largest\n"; } #### sub with_regexp { my $largest = ""; #for every line in the file, if it's length is greater #than the current longest, and it matches the set that #is all of the caracters in the RIGHT hand, not'ed, then #it is the largest open (INFILE, ") { chomp; if (length($_) > length $largest) { #NOTICE THE ! AT THE BEGINING if (! /[^yhnujmikolp]/i) { $largest = $_; } } } close (INFILE) || die "error $!"; print "LARGEST FOUND: $largest\n"; }