Just Another Perl / Unix Hacker

Are you really sure you want to spoil it for yourself so soon?

Here, I'll help you out. Here's a version of the program with some white space, normal variable and function names, and some of the micro-obfuscation removed.

     1	@STATE = split //, ".URRUUxR";
     2	@data = split//,"\nrekcah xinU / lreP rehtona tsuJ";
     3	
     4	sub make_pipe_and_fork {
     5	  @pipestate{"r$fhno", "u$fhno"}=(P,P);
     6	  pipe "r$fhno", "u$fhno";
     7	  ++$fhno;
     8	  ($pid *= 2) += $is_child = !fork();
     9	  map {
    10	    $STATE=$STATE[$is_child ^ ord($pipestate{$_}) & 6];
    11	    $pipestate{$_} = (/^$STATE/i ? $STATE : close $_);
    12	  } keys %pipestate
    13	}
    14	make_pipe_and_fork;
    15	make_pipe_and_fork;
    16	make_pipe_and_fork;
    17	make_pipe_and_fork;
    18	make_pipe_and_fork;
    19	
    20	map {
    21	  $pipestate{$_} =~ /^[P.]/ && close $_
    22	} %pipestate;
    23	
    24	wait until $?;
    25	
    26	map { /^r/ ? <$_> : 1 } %pipestate; 
    27	
    28	$_ = $data[$pid];
    29	sleep rand(2) if /\S/;
    30	print

It doesn't look so bad now, does it? Spend at least a little while trying to figure it out. If you do, you'll appreciate the solution that much more.

Hints

Hint 1 | Hint 2 | Hint 3 | Hint 4 | Hint 5 | Hint 6 | Hint 7 | Hint 8 | Hint 9 | Hint 10 | Hint 11

Solution

The solution really is here this time

Here's the plain-text version of the solution


Return to: Universe of Discourse main page | What's new page | Perl Paraphernalia | Obfuscation

mjd-perl-obfuscated@plover.com