in reply to Re: Difference between two arrays
in thread Difference between two arrays
$smallest = (sort @array)[0];
would give us 1 but your
$stored = shift @array;
would result in 2. Your condition would be met, your script exits with an error but the move is a valid one.
I think the only constraints were that a) the numbers are consecutive and b) one element is moved to form the new list. Thus in a list of 1 to 9, the 7 could be moved to the front giving 7,1,2,3,4,5,6,8,9 which would also fail in your script.
Cheers,
JohnGG
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Difference between two arrays
by kwaping (Priest) on Mar 22, 2006 at 17:38 UTC | |
by johngg (Canon) on Mar 22, 2006 at 20:28 UTC |