On Wed, 12 Mar 2003, Romeyn, Derek wrote: > K, I tried this and it didn't work as expected: > > $code =~ / HTTP\/\d\.\d\" (\d+)/; > if (!$code) { > print "NEXT\n"; > next; > } > print "$code\n"; > > > The loop just printed NEXT 300 or so times. I was thinking that $code would > equal whatever was in the parentheses. Am I still not getting this?
You're not capturing the correct string. Here's a code snippet I just tried on an Apache log that worked (assuming you have an open file handle): while(<LOG>) { print "$1\n" if m|HTTP.*\s+(\d{3})|g'; } $1 contains the matched string inside the parens (\d{3}). -- Brett http://www.chapelperilous.net/ ------------------------------------------------------------------------ We don't know who it was that discovered water, but we're pretty sure that it wasn't a fish. -- Marshall McLuhan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]