in reply to Tiptoe through the punctuation

Some interesting stuff. You're not fooling me with the comments, but you get ++ for assigning to some special variables I've never managed to find an excuse for assigning to.

I think I have a fair idea what it does, though, even though I don't use Tk myself except a couple of times a while ago.

And what is it with subs named _? Two of 'em in a row today, sheesh.

Oh, and on a personal note, cool home node. Wouldn't have replied just to say that, but since I was anyway...


for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc' .'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$ p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}

Replies are listed 'Best First'.
Re: Tiptoe through the punctuation
by jonadab (Parson) on Mar 11, 2003 at 01:54 UTC

    It has been suggested that I deobfuscate it...

    So it draws a regular pattern of crisscrossing lines. [runs it to see] close enough together that it looks like solid areas. We've all plotted this in junior high math, but usually on quarter-inch graph paper with one vertex each square; it looks quite different with directly adjascent vertices like this. The first four draw the inside shape, and the last four calls to _ draw the frame.


    for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc' .'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$ p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}

      Oh, and it's a bummer having the parens around the args on all the calls to _. It would have been much harder to read otherwise. Think in terms of...

      _$ ,,$;,$;,$%;_$,,$;,$;,-$%;_-$,,$;,$;,$%;_-$,,$;,$;,-$ %;_$",$,,$%,$";_$",-$,,$%,-$";_-$",$,,-$%,$";_-$",-$ ,,-$%,-$"

      But that spits syntax errors. So sad ;-)


      for(unpack("C*",'GGGG?GGGG?O__\?WccW?{GCw?Wcc{?Wcc~?Wcc{?~cc' .'W?')){$j=$_-63;++$a;for$p(0..7){$h[$p][$a]=$j%2;$j/=2}}for$ p(0..7){for$a(1..45){$_=($h[$p-1][$a])?'#':' ';print}print$/}

      Well done!

      $. is also known as $INPUT_LINE_NUMBER and is to be considered read-only. It is undefined until you read from a filehandle or it is assigned to by your program. If you assign a value to $. and then read from a filehandle, it will be reset to its proper value by Perl.

      Example:

      #!/usr/bin/perl -w use strict; print "\$. is ", $., $/; $. = 9999; print "\$. is now ", $., $/; print "Press <enter> to continue.\n"; my $input = <>; print "\$. is now ", $., $/;

        Almost correct.

        You can motify $. but you first have to have it pointing to the correct file handle:

        print "($.)\n"; # undefined $. = 10; print "($.)\n"; # 10, but for which file handle? print "ENTER: "; ''.<STDIN>; print "($.)\n"; # 1, for STDIN $. += 10; print "($.)\n"; # 11, still for STDIN print "ENTER: "; ''.<STDIN>; print "($.)\n"; # 12, not 2 !

                        - tye