With some no-ops removed.
#@a = split //,
# 'Juste re ha .eht'.
# 'r P kc l rona ';
@a = ('J','u','s','t','e',' ','r','e',' ','h','a',' ','.','e','h','t',
+'r',' ','P',' ',' ','k','c',' ','l',' ',' ','r','o','n','a',' ');
for($n=1;$i<4;){
# y/if/f/ unless@a;
do {
@a=reverse @a;
sleep $n
} if fork;
splice @a, @a/2;
$n*=2;
#goto P;
# P:
print shift @a;
$i++
}
#goto P if
#truncate STDERR,
#fileno STDERR%
#ord STDERR;
The actual printing is done by reversing the array (in the parent process only), cutting off the last half, and then printing a character. The sleep $n gets the order of the output all right. I'll be honest, I barely understand it :). ++, well done. For what it's worth, here's the array commented with the order (sorry for the long lines, it makes more sense when you unwrap them):
@a = ('J','u','s','t','e',' ','r','e',' ','h','a',' ','.','e','h','t',
+'r',' ','P',' ',' ','k','c',' ','l',' ',' ','r','o','n','a',' ');
# 1 1 1 1 8 12 5 5 7 7 14 10 3 3 3
+ 4 4 4 11 15 8 8 6 6 13 9 2 2 2 2
#@a = qw/1 1 1 1 8 12 5 5 n 7 7 14 10 3 3 3 4 4 4 11 15 8 8 n 6 6 13 9
+ 2 2 2 2/;