open my $file, "<", "my.file" or die "Can't open my file: $!"; while(<$file>) { # $_ has the current line print if /tts\s0./; print if /[tts30]/; print if /^[23]/; }