#!/usr/bin/perl -- use strict; use warnings; my $input = <STDIN>; chomp $input; while (<DATA>) { if ((/#bg\s$input/ .. /#be\s$input/) =~ /^\d+(?<!^1)$/) { print $_; } elsif (/bb\s$input/) { print $_; last; } # else # { # print "nope".$_; # last; # } } __DATA__ #bg at,super spaz razz tazz kazz #be at #bg as,clock brock spock mock sock #be as #bf am,lost fluff muff tuff cuff #be am bb lionsclub
In reply to troubleshooting filehandle by kwn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |