Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^4: Four part JAPH

by cog (Parson)
on Apr 18, 2005 at 13:39 UTC ( [id://448849]=note: print w/replies, xml ) Need Help??

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

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|>.

Replies are listed 'Best First'.
Re^5: Four part JAPH
by ambs (Pilgrim) on Apr 18, 2005 at 14:27 UTC
    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.

Re^5: Four part JAPH
by ghenry (Vicar) on Apr 18, 2005 at 13:46 UTC

    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 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 Just ask!!!
        $; default value is "\034". Set it to that value.

        Update: Ok, it seems it is not related with the contents of this variable.

        Alberto Simes

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2024-05-22 04:19 GMT
Find Nodes?
    Voting Booth?

    No recent polls found