in reply to Use perl to do direction matching

my @column = split (/,/,$line); my $A = $column[4] < $column[7] ? $direction[0] : $direction[1]; my $B = $column[5] < $column[8] ? $direction[2] : $direction[3];

But use meaningful names!

my ($at_x, $at_y, $goal_x, $goal_y) = ( split(/,/, $line) )[4,5,7,8]; my $x_dir = $at_x < $goal_x ? 'East' : 'West'; my $y_dir = $at_y < $goal_y ? 'North' : 'South';

Replies are listed 'Best First'.
Re^2: Use perl to do direction matching
by hujunsimon (Sexton) on Oct 09, 2009 at 15:38 UTC

    it works, thanks a lot guys !