kwn has asked for the wisdom of the Perl Monks concerning the following question:
#!/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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: troubleshooting filehandle
by JavaFan (Canon) on Oct 17, 2008 at 21:02 UTC | |
by kwn (Novice) on Oct 17, 2008 at 21:39 UTC | |
by Jenda (Abbot) on Oct 17, 2008 at 22:01 UTC | |
by kwn (Novice) on Oct 18, 2008 at 02:07 UTC |