in reply to Finding number of 'k'-clique in a graph

When I run your code, I get no output at all. There is a trick that I can suggest, and I'll illustrate it with a simpler example. Say you want to find all the sequences of three digit-strings in a string, so if your string is "11 22 33 44", you'd get "11 22 33" and "22 33 44".

The trick is to include some code that runs when you've found a match, and then cause the whole expression to fail, so that it backtracks to try again.

$_ = '11 22 33 44'; /\b\d+ \d+ \d+\b(?{print "$&\n"})^/;
I've told it to match the beginning of string after it executes my code. That's an impossible match, so the regex goes back and tries again.

Caution: Contents may have been coded under pressure.