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.

In reply to Re: Finding number of 'k'-clique in a graph by Roy Johnson
in thread Finding number of 'k'-clique in a graph by monkfan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.