Re: how to write a "od -bc" like function?
- From: "John W. Krahn" <dummy@xxxxxxxxxxx>
- Date: Fri, 31 Aug 2007 08:22:46 GMT
Josef Moellers wrote:
jck11 wrote:hi all
Could any one give me a direction to write a function to match the unix-like
function "od -bc" do.
Now I only get the idea of opening the file.
open(IN, "filename")or die;
my $str=<IN>;
.............
close(IN);
By the way, if the file is a exe or image type, the $str seems don't work
correctly.
Apart from the usual: three-argument "open", lexical filehandles, and explicit '<':
1. if you're dealing with binary files, you must tell perl this: "binmode IN;" after open(...), and
Or use the open pragma:
use open IO => ':raw';
perldoc open
John
--
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order. -- Larry Wall
.
- References:
- how to write a "od -bc" like function?
- From: jck11
- Re: how to write a "od -bc" like function?
- From: Josef Moellers
- how to write a "od -bc" like function?
- Prev by Date: Re: Solaris 10 gcc 3.4.6 perl compile error HELP!
- Next by Date: FAQ 2.10 Where should I post source code?
- Previous by thread: Re: how to write a "od -bc" like function?
- Next by thread: FAQ 1.4 What are Perl 4, Perl 5, or Perl 6?
- Index(es):
Relevant Pages
|
|