Harry - What do you mean it won'r work? I ran the following:
use strict; my @list = (1,2,3,12,13,14,16,17,18,1,2,3,19,20,21,22); my %conseq; $conseq{$_} = $_ for (@list); for (keys %conseq) {delete $conseq{$_} unless $conseq{$_-1} or $conseq{$_+1}} my @conseq; push @conseq, $_ for (sort {$a <=> $b} keys %conseq); print "$_\n" for (@conseq); which produced the _correct_ result: 1 2 3 12 13 14 16 17 18 19 20 21 22 Aloha - test before you post - Beau. -----Original Message----- From: Jackson, Harry [mailto:[EMAIL PROTECTED]] Sent: Sunday, May 19, 2002 10:49 PM To: [EMAIL PROTECTED] Subject: RE: help! > -----Original Message----- > From: Beau E. Cox [mailto:[EMAIL PROTECTED]] > > > Ok, but, but... > > I ignored uniqueness because non-unique numbers are NOT consecutive. > My solution works on non-sorted input arrays. To be a picky twat. my @array = (1,2,3,12,13,14,16,17,18,1,2,3,19,20,21,22); It would not work on the unsorted array above. Even if we where to sort this array if sort in perl is anything like the shell then it will not sort numerically. Harry **************************************************************************** ********* COLT Telecommunications Registered in England No. 2452736 Registered Office: Bishopsgate Court, 4 Norton Folgate, London E1 6DQ Tel. +44 20 7390 3900 This message is subject to and does not create or vary any contractual relationship between COLT Telecommunications, its subsidiaries or affiliates ("COLT") and you. Internet communications are not secure and therefore COLT does not accept legal responsibility for the contents of this message. Any view or opinions expressed are those of the author. The message is intended for the addressee only and its contents and any attached files are strictly confidential. If you have received it in error, please telephone the number above. Thank you. **************************************************************************** ********* -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]