in reply to Tracing warnings: how to show the regexp values?
You should always check to see if your capture matched anything before using it.
if ( $2 ) { ... } else { ... }
Edit: ... By which I do not mean to suggest that you should always use an explicit if conditional: as my learned colleague explains below, there are any number of reasons you might get an undefined value. The point is your code should be ready for it, whether with an explicit test, no warnings, or howsoever you deem best.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: On error, how to show the regexp values?
by LanX (Saint) on Jan 07, 2017 at 14:40 UTC | |
|
Re^2: On error, how to show the regexp values?
by nikolay (Beadle) on Jan 19, 2017 at 07:58 UTC |