I am trying to convert a simple segment of code from java to perl but the result is so different that I haven't been able to figure out what the cause is.
Java Code:
int aA[] = {49, 112, 251, 146, 1, 240};
char aB[] = {'N', 'o', 't', '4', 'M', 'e'};
for (int i=0; i<6; i++) {
System.out.println((char)aA^aB);
}
Java Result: 127,31,143,166,76,149
Perl Code:
@aA = ('49', '112', '251', '146', '1', '240');
@aB = ('N', 'o', 't', '4', 'M', 'e');
for ($i=0; $i<6; $i++) {
$result = $aA[$i] ^ $aB[$i];
print ord($result), "\n";
}
Perl Result: 122,94,70,5,124,87
Java Code:
int aA[] = {49, 112, 251, 146, 1, 240};
char aB[] = {'N', 'o', 't', '4', 'M', 'e'};
for (int i=0; i<6; i++) {
System.out.println((char)aA^aB);
}
Java Result: 127,31,143,166,76,149
Perl Code:
@aA = ('49', '112', '251', '146', '1', '240');
@aB = ('N', 'o', 't', '4', 'M', 'e');
for ($i=0; $i<6; $i++) {
$result = $aA[$i] ^ $aB[$i];
print ord($result), "\n";
}
Perl Result: 122,94,70,5,124,87