in reply to Counting PDL vectors in a PDL matrix

Oh, wow! I've never heard of PDL. This is spiffy as all get out. Okay, here's how I'd go about it. . .
#here's an array my @a = (1,2,3); #now it's a string: my $string = join '', @a; #here's another array my @b; #Now the array values your looking for become an array element. #Increment when those values come up again. $b[$string]++; # so $b[123] now = 1 #Leading zeroes disappear, so you could add a 1 to the front of $strin +g. $string = '1' . join '', @a; $b[$string]++; # so $b[1123] now = 1 #yeah. that'll work #I might write the whole thing as: my @a = all your stuff as little array refs from wherever my @b = the answers you want; for (@a) my $string = '1' . join '', @$_; $b[$string]++ } #after that, you could copy to an array of tuples: # e.g., $c[2] = (["123"],[5]); #strip that extra '1' and turn to strin +g? # $c[2] = (["info"], [number of times you find it]); # might make it easier to play with. #would %b be faster than @b? I prefer arrays, but that's my bias. #$b{$string}++ would certainly work. But, is it as easy to muck about +with? #that extra '1' for referencing the elements does bother me a bit.
$state{tired}?sleep(40):eat($food);