I am having trouble even reading a pgm file in perl. Does anyone know how to do this? (pgm file is the binary version not ASCII)
This is my code, I was attempting to only read the header portion of pgm file:
#!/usr/bin/perl
open(TEST, "baboon.pgm") or die "can't open \n";
binmode(TEST);
while(<TEST>){
if($counter<=7){
chomp;
print "$_ ";
$counter++;
}
else{
exit 0;
}
}
close(TEST);