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.


In reply to Re: Re: 29 characters to beat Ruby ... by dragonchild
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.