Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^3: Four part JAPH

by ghenry (Vicar)
on Apr 18, 2005 at 13:26 UTC ( [id://448844]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Four part JAPH
in thread Four part JAPH

Nope ;-)

perl -e "print $="

Gives 60, on a Win2k, ActiveState 5.8.6 install.

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!

Replies are listed 'Best First'.
Re^4: Four part JAPH
by cog (Parson) on Apr 18, 2005 at 13:39 UTC
    Well, the word "Perl" should come out right as long as $=/($*+$,)+$| equals 11 and $; equals 0.

    By the time the code gets there, $| is 1, $* is 2 and $, is 4, so $=/($*+$,)+$| = 60/(4+2)+1 which in turn equals 11. In your case, the result of that operation is probably returning 27 instead of 11 (if I did my calculations right).

    One of those four variables is not getting the proper value it should. Try this: in the code, right before $a="\104\101\124\101", add something like print"<$=|$*|$,|$||$;>\n";, and then we'll be able to see what's wrong :-)

    The correct output for that code should be <60|2|4|1|>.

      It seems that $; is different. In Linux it is \034. On windows is any weird character. As the perlvar manpage explains, $; values cannot be safe if you have binary keys. I think ActiveState might have changed its value to a unicode value they think is not much used.

      Update: Accordingly with some folks on #perl ActiveState use the same value. Just don't know why the print prints that weird character.

      Modified code is now:

      END{s{}{"@{[map{$%=$_;$_=&{$_{$_}};$%%2&&s%.%\u$&%;$_}($|..${$/=\ ($^A+$|+$?)})]},"}e;print}($,,$,,+$*,$,,$,)=($|..$=/(+++$^A+$^A)* +++$^A*++$^A);@_{++$|..2**(++$-+$-)}=(sub{(join$',map{+chr($|+$,+ ord($_))}reverse((split$`,&{$_{$=/($,*$,+$,)}})[$...$|]))."${\'s' }".substr(&{$_{2}},$^A,$|)},sub{"anoth".substr(&{$_{$^A}},+$-,$-+ $|)},sub{ print"<$=|$*|$,|$||$;>\n"; $a="\104\101\124\101";!seek$a,$=/($*+$,)+$|,$;or~~<$a>}, sub{local$";"@{[(split//,(chr($^A-$|+ord(substr(&{$_{$^A-$|}},+$? ..++$?)))).&{$_{$,/($^A-$|)}}.chr(2*$=-$^A*$,-$|))[$,+$|,$|,$--$| ,+-+$|,-$|x$?,+$=/(0+$,*+$*+-+-$*),$,+-+-~~$*+-+-$|]]}"});__END__

      Which gives:

      J:\>perl japh <60|2|4|1|&#8735;> <60|2|4|1|&#8735;> <60|2|4|1|&#8735;> <60|2|4|1|&#8735;> <60|2|4|1|&#8735;> <60|2|4|1|&#8735;> R`st anothma [map hackma,

      Walking the road to enlightenment... I found a penguin and a camel on the way.....
      Fancy a yourname@perl.me.uk? Just ask!!!

        Adding $;=""; before END as per cog's request, makes things worse:

        J:\>perl japh <60|2|4|1|> <60|2|4|1|> <60|2|4|1|> <60|2|4|1|> <60|2|4|1|> <60|2|4|1|> éÇst anoth}{ {}{" hack}{,

        And perl -e 'print "<$;>"'

        Gives nothing. Maybe a newline?

        Maybe someone else can help?

        Walking the road to enlightenment... I found a penguin and a camel on the way.....
        Fancy a yourname@perl.me.uk? Just ask!!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://448844]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-03-28 15:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found