in reply to Yet another JAPH

All I get is the error "Modification of a read-only value attempted at -e line 3." I haven't yet started to take a look at the code to see what is wrong...

Replies are listed 'Best First'.
Re: Re: Yet another JAPH
by Mr. Muskrat (Canon) on Mar 23, 2003 at 18:54 UTC

    It works fine for me on Windows 98, AS Perl 5.6.1 build 635. But I suspect it does not work for you because of the use of $$ (process ID).

      Right, Perl (5.8.0 on Linux) doesn't like the script trying to modify $$. Anyway, what does it output? (I tried setting a temp variable at the top to $$ and used that variable instead of $$ (so there's no more error), but it didn't do anything.)

        You need to replace all instances of @$ too. Something like:

        #!/usr/bin/perl $_='0b1d35022f290d59436b612b034f531747493d676d130507651125713b1f7f';@_ +=qw/0B 25 00002 00011 02/;while($_ =~ /^(..)((?:..)+)$/){push @~,hex( +$1);$_=$2;}@~=sort {$a <=> $b} (@~,hex $_);map{$~^=$~;$~++;map{$~*=$~ +[hex $_];}(split('',$_));print chr $~;}@_;

        Note: I did not check if $~ is a read-only variable in 5.8. This was more of an example of what all needs to be changed. YMMV.