while (){ /ATDT\d+\s+BUSY/ ? print : print "Did not match '$_'\n"; #print if /ATDT\d+\s+BUSY/; #print if /ATDT\d+.*BUSY/s; #print; }