Caldeira Alexandre-WAC075 wrote:

> 
>  
> Hi Everybody,
>  
> I got the following problem using Active Perl:
>  
> I need to read a file that is HEXA encoded. I whant to see (when do a
> print command) the HEXA values, like 8D and etc...
> Do you know how to open and manage a file in hexa?

Do you mean HEX ASCII when you say HEXA ?

> All the time that I tried Perl try to convert this to ASCII or UTF-8
> encoding...
>  
> ...
> binmode(FILE);
> $file_name= $ARGV[0];
> open(FILE,$file_name)
>  || die "could not open Source file\n";

# binmode goes after the open.

  binmode FILE;

# you may want to slurp the whole file if feasible and then split on
# your 80 or 8D

{ local $/ = undef; $_ = <FILE>; }
my @linha = split /8D/i;
close FILE;

> while(<FILE>)
>  {
> chomp;
>  
>                                   #
>   @linha = split(/8D/);   # A partir desse momento $linha[0] vale a
> primeira linha
>                                   #
> ...
>  
> The idea is to split all the sorce file when found the 80h value.
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to