in reply to Re: Critique yet another List-to-Range function
in thread Critique yet another List-to-Range function

For posterity sake, I thought I'd note that there is a problem with this.
#!/usr/bin/perl -w my @test = ((1..3), 5, (7..9), (11..12), (17..19)); sub range { @_=sort{$a<=>$b}@_;@r=($l)=$_[0]; map{if(abs$l-$_>1){push@r,$r=$_; $r[-2].="~$l";}$l=$_;}@_;@r; } my @ranged = range(@test); print "@test \n"; # prints 1 2 3 5 7 8 9 11 12 17 18 19 print "@ranged \n"; # prints 1~3 5~5 7~9 11~12 17


-Lee

"To be civilized is to deny one's nature."