See all valid Perl code ("use strict" is in force, else the results are less interesting) consisting of 3 typical characters with optional whitespace:

use strict; use Algorithm::Loops 'NestedLoops'; my @chars= map chr($_), ord(' ') .. ord('~'); my @spaces= ( "", "\n", shift @chars ); my $iter= NestedLoops( [ ( \@chars, \@spaces ) x 2, \@chars, ], { OnlyWhen => sub { @_ % 2 }, }, ); sub dump { 1; } sub exit { 1; } $SIG{__WARN__}= sub { 1; }; close STDIN; my @code; while( @code= $iter->() ) { my $code= join '', @code; if( eval "$code; 1" ) { print "($code)\n"; } }

It is trivial to expand this to look at larger code strings... but the results are less interesting, again. :)

- tye        


In reply to Re: Brute force perl (ex) by tye
in thread Brute force perl by jagh

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.