in reply to Re: Difference between two arrays
in thread Difference between two arrays

Thanks for your solution. It's pretty much what I was looking for. :-)

But.. are you sure if that code works for any input data one could think of? Couldn't the

$after->[$lo_1 + 1]

result in an undefined value when $lo_1 equals $#{$after}?

Cheers, Flo

Replies are listed 'Best First'.
Re^3: Difference between two arrays
by reasonablekeith (Deacon) on Mar 23, 2006 at 10:30 UTC
    $lo_1 would never be the last index in the array, so no.

    The highest order change is either moving element index 8 to 9 or moving 9 to 8. In either case $lo_1 will be 8, and $lo_1 + 1 will be 9, and in range.

    I think the above is the best solution here.

    ---
    my name's not Keith, and I'm not reasonable.