p4raw-link: @8818 on //depot/maint-5.6/perl:
26f0d336d3c5218555245ccab94cfd5b1ccf5312
p4raw-id: //depot/perl@8819
p4raw-integrated: from //depot/maint-5.6/perl@8816 'copy in'
pod/perlfaq4.pod (@8627..)
If @in is sorted, and you want @out to be sorted:
(this assumes all true values in the array)
- $prev = 'nonesuch';
+ $prev = "not equal to $in[0]";
@out = grep($_ ne $prev && ($prev = $_, 1), @in);
This is nice in that it doesn't use much extra memory, simulating