Courtney1306
Programmer
I have a file in excel with two columns of hex numbers. I need to change them all to decimals. The code works when I use a specific hex, but when I try to search the field it prints all 15's from first column when they should be 0. The second column is also wrong. Can someone help?!
open (E, "RETURNCAL3.csv") || die ("Could not open file!");
while ( $file = <E> ) {
@field = parse_csv($file);
chomp(@field);
$i_test = hex("field[1]");
$q_test = hex("field[2]");
$mag_test= sqrt(($i_test**2)+($q_test**2));
print "$i_test, q_test, $mag_test \n";
}
close E;
open (E, "RETURNCAL3.csv") || die ("Could not open file!");
while ( $file = <E> ) {
@field = parse_csv($file);
chomp(@field);
$i_test = hex("field[1]");
$q_test = hex("field[2]");
$mag_test= sqrt(($i_test**2)+($q_test**2));
print "$i_test, q_test, $mag_test \n";
}
close E;