in reply to Re: 29 characters to beat Ruby ...
in thread Is Perl less compact than Ruby? (Kind of competition)

I tried @L=@L,push@C,lc=~/./g and it didn't work. I don't know enough of the language to be able to say why, but it didn't.

This could only apply to the first push because I need the return value of the second push to be the value of the @L. Remember, @L is recording the byte that starts each line. @C is the list of bytes.

In addition, map{push@L,push@C,lc=~/./g}for 0,<>; also didn't work. It puts 1 as the first element of @L, and 0 as the first element of @C. *shrugs*

However, we can add a character, going back up to 327, and get it right:

@L=(0,map{push@C,lc=~/./g}<>}; ---- Results in ---- @L=(0,map{push@C,lc=~/./g}<>};sub p{$_=pop@n}sub w{push@n,@_}while($n< +@C){$_=$C[$n++];if(/h/){p;w$n[-1-abs];$_>0&&splice@n,-2-$_,1}if(/n/){ +w 0;$b<0||w$b+7*p while($b=index"htaoinse",$C[$n++])<7}$0=p,p,w int$_ +/$0,$_%$0if/e/;$a=p,p&&($a?$n=$L[$a-1]:last)if/t/;/a/?w 1+grep$n>$_,@ +L:/o/?print chr p:/s/?w-(p)+p:/i/&&w ord getc||-1}

Update: Make that 326 again.

@L=(0,map{push@C,lc=~/./g}<>};sub p{$_=pop@n}sub w{push@n,@_}while($n< +@C){$_=$C[$n++];r,w($n[-1-abs]),$_>0&&splice@n,-2-$_,1if/h/;if(/n/){w + 0;$b<0||w$b+7*p while($b=index"htaoinse",$C[$n++])<7}$0=p,p,w int$_/ +$0,$_%$0if/e/;$a=p,p&&($a?$n=$L[$a-1]:last)if/t/;/a/?w 1+grep$n>$_,@L +:/o/?print chr p:/s/?w-(p)+p:/i/&&w ord getc||-1}

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.