Update forgot to sort the big arraysub consecutive_array { return scalar ( $_[0]..$_[-1] ) && # option: ! grep { /\D/ } @_ && # checks for digits only join "_", @_ eq join "_", ($_[0]..$_[-1]); } #UPDATE, need to sort this array too to work, oops :-) my @bigarray = sort map { ( $_->{array} ) } keys %hash; my $valid = $bigarray[0] == 0 && consectutive_array( @bigarray ) && ! grep { !consectutive_array( $_->{array} ) } keys %hash;
-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com
||
"You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important
In reply to Re: joining and sorting arrays
by Masem
in thread joining and sorting arrays
by hotshot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |