in reply to Uninitialized variable matches regex
Update: A little more detail. Your regex has the following three components:
The act of binding a scalar to the regular expression stringifies it (as Anonymous Monk points out below). That is why your number assignment matches. So once you bind undef (with appropriate warning suppression), undef becomes '', which has a start, 0 digits and an ending, and thus matches.
As an interesting note, you also match on $id = "\n";, and if you use the m modifier, you match $id = "My favorite number is:\n42\nWhat's yours?";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Uninitialized variable matches regex
by Rodster001 (Pilgrim) on Mar 23, 2009 at 20:56 UTC |