in reply to Re^2: Use perl to do direction matching
in thread Use perl to do direction matching
It's not an error, it's a warning. So you have to find out why it's undef. Check the code where you assign to it, find out which branch it took, why the value you assign to it is undef etc.
You know that $A is either $direction[0] or $direction[1], so try to print those:
use 5.010; # enable say(), which is shorter than print ..., "\n"; ... say "Direction 0: '$direction[0]'"; say "Direction 1: '$direction[1]'";
That should give you some clue of what's wrong. You can also use Data::Dumper for debugging.
Oh, and you still haven't chosen a better name for $A - you really should. Since Perl doesn't know what your code means (at least not in the way you think it should), you should help us understand what it should mean - by using a good names, for example.
For fixing it, I recommend reading the section List value constructors in perldata, or at perlintro.
|
|---|