On Sat, 17 Sep 2005, Chad wrote: > I have a file with the following: > (0 rows affected) > SQL1\SQLPROD4 > > When I run the following code it finds my match, but why isn't $1 populated? > > $/ = ''; > open (VALIDFILE, "valid.txt") || die "Couldn't open file: $!"; > while ( <VALIDFILE> ) > { > > if (/SQL1\\SQLPROD4/) > { > print "The text matches the pattern.\n"; > print "\$1 is '$1'\n" if defined $1; > } > } > close(VALIDFILE); >
I think you have to capture $1, try if (/(SQL1\\SQLPROD4)/) Owen -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>