herby1620 has asked for the wisdom of the Perl Monks concerning the following question:
Use of uninitialized value in split at <routine/line> during global destruction.
The code is pretty simple (reconstructed a bit):
My question: how do I detect that this error is GOING to happen with the called arguments (in this case to the 'fool' routine) so I can print out a more intelligent error message?sub fool { my @vals; my $n; my $i; while (@_) { @vals = split /(\n)/, (shift); # Error happens here $n = @vals; for ($i = 0; $i < $n; $i++) { print "The value is: $vals[$i] \n"; # Or similar action } } }
Is there any way I can "produce" this same error message using the 'fool' routine as shown above. It would "enlighten" me quite a bit.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Wierd error message
by graff (Chancellor) on Aug 16, 2006 at 03:00 UTC | |
by herby1620 (Monk) on Aug 16, 2006 at 22:13 UTC | |
Re: Wierd error message
by Zaxo (Archbishop) on Aug 16, 2006 at 02:19 UTC | |
by chromatic (Archbishop) on Aug 17, 2006 at 01:03 UTC | |
by Zaxo (Archbishop) on Aug 17, 2006 at 01:13 UTC | |
Re: Wierd error message
by roboticus (Chancellor) on Aug 16, 2006 at 02:18 UTC | |
by ikegami (Patriarch) on Aug 16, 2006 at 03:52 UTC | |
Re: Wierd error message
by ikegami (Patriarch) on Aug 16, 2006 at 02:21 UTC | |
Re: Wierd error message
by jdporter (Paladin) on Aug 16, 2006 at 04:25 UTC | |
Re: Wierd error message
by ysth (Canon) on Aug 16, 2006 at 15:22 UTC |