while (my $regex = ) { chomp $regex; if (length($regex) > 1 && $sampletext =~ $regex) { ... } }