Down to 340 bytes:

map{push@L,@C+0;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;/ +-/||w$_+7 *p while($_=index"htaoinse",$C[$n++])<7}$0=p,$_=p,w int$_/$0,$_%$0if/e +/;if(/t/) {$_=p;$_?$n=$L[$_-1]:last if p}/a/?w 1+grep$n>$_,@L:/o/?print chr p:/s +/?w-(p)+p :/i/&&w($_=getc)?ord:-1}

We can s/last if p/p&&last/ and that brings it own to 338 bytes:

map{push@L,@C+0;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;/ +-/||w$_+7 *p while($_=index"htaoinse",$C[$n++])<7}$0=p,$_=p,w int$_/$0,$_%$0if/e +/;if(/t/) {$_=p;$_?$n=$L[$_-1]:p&&last}/a/?w 1+grep$n>$_,@L:/o/?print chr p:/s/? +w-(p)+p: /i/&&w($_=getc)?ord:-1}

But wait, there's more! change $0=p,$_=p,w int$_/$0,$_%$0 to w int($_=p)/($0=p),$_%$0} Which gives 337 (I think) bytes:

map{push@L,@C+0;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;/ +-/||w$_+7 *p while($_=index"htaoinse",$C[$n++])<7}w int($_=p)/($0=p),$_%$0if/e/; +if(/t/) {$_=p;$_?$n=$L[$_-1]:p&&last}/a/?w 1+grep$n>$_,@L:/o/?print chr p:/s/? +w-(p)+p: /i/&&w($_=getc)?ord:-1}

A ternary operator can be replaced by a && and the plus in w+($_=getc)?ord:-1 trick is not needed, it works without (or, at least, hello.eta still outputs correctly).

I have an idea it must be possible to replace the w$_+7*p while($_=index"htaoinse",$C[$n++])<7 section with a redo and/or a pos, but it is so difficult to understand what the program does I am beginning to wonder whether it wouldn't be easier to look at the instruction set and come up with another angle of attack. For instance, it would be nice to be able to do away with the @L array as well. Replace @C and @L by a hash that is keyed on byte offset and the value is the byte.


print@_{sort keys %_},$/if%_=split//,'= & *a?b:e\f/h^h!j+n,o@o;r$s-t%t#u'

In reply to Re: last version by grinder
in thread Is Perl less compact than Ruby? (Kind of competition) by locked_user mtve

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.