(print "" =~ /.*/) and "" =~ /bar/
The first regex match succeeds (thus the 1), and the result of the second one is discarded. Use && instead of and to get the result you want.
See also: perlop.
In reply to Re: perl regular expressions and empty strings unexpected results
by moritz
in thread perl regular expressions and empty strings unexpected results
by bdimych
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |