regex matching statements

Jeff Peng via beginners <[email protected]> Wed, 19 Jun 2024 09:55:25 +0800
Newsgroups gmane.comp.lang.perl.beginners
Message-ID <[email protected]>
Hello list,

are these statements the same in perl?

$ perl -le '$_="abc";if (!/\w+\d+/){print "not matched"}'
not matched

$ perl -le '$_="abc";if ($_ !~ /\w+\d+/){print "not matched"}'
not matched

or which is the better one?

Thanks.

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/