Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Actually I thought STDOUT of here was quite challenging and educational. Perhaps I made my analysis a bit too tidy. Some of the insights I had into your program were things I really hadn't considered before.

In particular, I was surprised to learn about END blocks executing in reverse order, and I didn't really have a clear idea of how Perl interprets barewords since I usually avoid them. I also didn't realize until after I had posted my analysis that what I referred to as "empty BEGIN; and END; statements" were in fact redeclarations of sub BEGIN and sub END and that's why they didn't show up in the perl -MO=Deparse output.

I'm afraid I have to disagree with you on Code eating code. Your Perl::Tidy suggestion was kind of a tip-off about what you're doing. Tidying does break the code, but...

the tidied version can be fixed as below so that it reads the original source file instead of the tidied source file.

I'm using a C++-style << "operator" to indicate what each line prints.
#!/usr/bin/perl open( eval STDIN, do { (local $_ = $0) =~ s/\.tdy$//; $_ } ); $= = @ARGV = <>; # 16 lines @h = split //, shift; # "#!/usr/bin/perl\n" $- = @ARGV; # 15 lines { local $" = 't'; ( $b = "@{[@h[3,4]]}" ) =~ y~st~ts~; # "ust" } $h = ucfirst join '', @h[ -5 .. -2 ], $"; # "Perl " &39; # "JHV\x9c\x9a\x99V\x89\x90\x95V\x97\x8c\x99\x931" $b = $h[0] . $b . $"; # "Just " print $b; # << "Just " @h = split //, shift; # "open(eval STDIN,\$0);\$==\@ARGV=<> ;\@\n" # 0123456789012345 6789 012 3456789012 3 4 @_ = map { lc } @h[ $= - 3**2, # 16 - 9 == 7 -> a $= % ( $- / 3 ) + 2, # 16 % 5 + 2 == 3 -> n 2**4 - $=, # 16 - 16 == 0 -> o ( 1 x 2 ) x 2, # 11 x 2 -> tt 2, @h - 10, 3**( @h % 3 ) # 2 -> e, -10 -> r, 3 ** (35 % 3) == 9 -> +" " ]; print @_[ 0 .. 3 ], 'h', @_[ 5 .. @ARGV / 2 ], $h, h; # << "another Pe +rl h" $h =~ s/^.//; # "erl " $h =~ s/...$//; # "e" @h = @h[ 0 .. ( ( ( length $ARGV[6] ) - 5 ) / 2 ) ]; # "open(eval STDI +N," &{-14} && print $h[0]; # "abW`\x1aWhS^\x12EF6;\@\x1e" << "a" &14; # "open(eval STDIN," print map lc, @h[ &1 + 6, 6 * 2 + &1 ]; # "qrgp*gxcn\"UVFKP." << "ck" # 012345678 9012345 # ^ ^ print $h, $h[1]; # << "er" print @h[ &{-2} + 1 ]; # "open(eval STDIN," << "," $ARGV[0]; # no-op sub AUTOLOAD { ( ( $a = $AUTOLOAD ) ) =~ s s.*::sss; # extract subroutine name, e.g. "39" for "&39;" $_ = chr( $a + ord $_ ) for @h; # add name as a number to @h $a; # return name, e.g. "39" }

In reply to Re: Code eating code by jdalbec
in thread Code eating code by cog

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-25 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found