in reply to Strange "undefined value as an ARRAY reference" error
I used a package rather than lexical array to avoid "Variable ... will not stay shared ..." warnings
You shouldn't have this problem if your code is as you posted. Please try it using my. Results will be different, and examining the differences should be illuminating.
I don't quite understand why it is so, but there seems to be a problem with the following syntax when the sub returns undef:
Lastly: You should definitely be checking $reference for a valid value before subjecting it to any further operations. If you have pat_mc throw an explicit error (die) when $reference is undef, you'll probably get a much more useful diagnostic than letting it fail inside a bizarro regex code pattern. :-)print qq{pat_mc : @{ [ pat_mc() ] }\n};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Strange "undefined value as an ARRAY reference" error
by ikegami (Patriarch) on Jan 08, 2009 at 01:49 UTC |