- May 31, 2002
- 71
- 0
- 0
I have a .dat file that I need to read into a perl program. If I look at this file in ultraedit it is just a bunch of hex. I need to read each hex number into an array so that I can later rearrange and convert to decimal. for example:
000002AA08 would read in as
@array[0] = 00
@array[1] = 00
@array[2] = 02
@array[3] = AA
@array[4] = 08
is this possible? what I have done so far is below but it just prints me out a bunch of garbage. i know right now it is only reading into a string but i need to get the string correct before i can break into an array, i believe. any help here would be greatly appreciated.
#!/usr/bin/perl
$nabl_stand_file="fat1r1.dat";
open(nabl_standr, $nabl_stand_file) || die("Could not open file!");
$string_nabl=<nabl_standr>;
close(nabl_standr);
print ($string_nabl);
000002AA08 would read in as
@array[0] = 00
@array[1] = 00
@array[2] = 02
@array[3] = AA
@array[4] = 08
is this possible? what I have done so far is below but it just prints me out a bunch of garbage. i know right now it is only reading into a string but i need to get the string correct before i can break into an array, i believe. any help here would be greatly appreciated.
#!/usr/bin/perl
$nabl_stand_file="fat1r1.dat";
open(nabl_standr, $nabl_stand_file) || die("Could not open file!");
$string_nabl=<nabl_standr>;
close(nabl_standr);
print ($string_nabl);