LockWolf
LockWolf

Reputation: 21

I cannot find the errorerror. Geocaching Mystery

I'm confused about this code. It's part of a geocaching puzzle. I read it as far as I could understand. But I never used java for my own.
I hope someone can help me correcting it.

use strict; 
$a = (32,69,34,46,5,19,4) my $a = 39;
printf("%s%d\a%s%0.1f\b%0.0f%s\t" chr(78) 061 chr($a[2]-2) 0xa+0x1b/1-2*5 0b110101111101001000/0x3e8 chr($a));
printf("%s%#.3d%s%s%d%s%0.0f'\n" chr($a[1]) 013 chr($a[0]) chr($a[0]+16) 0x05 chr($a[3]-$a+$a[6]*$a[4]+$a[5])) 0xF07A8/0b1111101000);

Many thanks for any help LockeAndWolf

Upvotes: -2

Views: 227

Answers (1)

explv
explv

Reputation: 2759

The corrected script is:

use strict;
my @a = (32,69,34,46,5,19,4);
my $a = 39;
printf("%s%d\a%s%0.1f\b%0.0f%s\t", chr(78), 061, chr($a[2]-2), 0xa+0x1b/1-2*5, 0b110101111101001000/0x3e8, chr($a));
printf("%s%#.3d%s%s%d%s%0.0f'\n", chr($a[1]), 013, chr($a[0]), chr($a[0]+16), 0x05, chr($a[3]-$a+$a[6]*$a[4]+$a[5]), 0xF07A8/0b1111101000);

Output:

N49 27.221'     E011 05.985'

List of errors:

  1. $a declared as a scalar when it is an array, should be @a
  2. Missing commas in the print statements
  3. Extra right bracket in the second print statement (the right bracket before the last one).

Upvotes: 2

Related Questions