Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm using a regexp to parse thru a file that contains output from a grep. The grep was on the pattern "*.pl" -- I went and greped for all html files that are calling perl scripts on my site.
I'm trying to do a pattern match for "pl", and print the match, which hopefully will give me a nice list of all the perl scripts with no extraneous html.
Here's the code that doesn't get a match for anything (right now I'm just printing to stdout until I figure out why the regexp isn't matching):
#!/usr/bin/perl open FILE, "grepfile" or die "where is grepfile?"; while ( $blah = <FILE> ) { $blah =~ /pl/; if ($1) { print $1 } else { print "no match" } } print $1; close FILE; exit;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: pattern matching -- feeling stoopit
by Caillte (Friar) on Oct 02, 2001 at 20:36 UTC | |
by Anonymous Monk on Oct 02, 2001 at 20:43 UTC | |
|
Re: pattern matching -- feeling stoopit
by arturo (Vicar) on Oct 02, 2001 at 20:50 UTC |