Data::HexDump(3)
π NAME π
Welcome to the Data::HexDump(3) page, bestie β it's filed under User Contributed Perl Documentation, and it's here to serve hex-dump realness. The module is Data::HexDump β Hexadecial Dumper. (Yes, "Hexadecial" is spelled exactly like that. We don't fix lore around here π
β¨)
β¨ SYNOPSIS β¨
Functional interface? Say less:
use Data::HexDump;
print HexDump($data_string);
OO interface? Also iconic:
use Data::HexDump;
my $dumper = Data::HexDump->new();
print while $_ = $dumper->dump;
πΈ DESCRIPTION πΈ
This module generates a hexadecimal dump of a data string or file. You can either use the exported function (like the SYNOPSIS above shows) or the OO interface, described below. Both are valid, both are cute.
The second example from the SYNOPSIS generated this output:
00 01 02 03 04 05 06 07 - 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF
00000000 23 21 2F 75 73 72 2F 62 - 69 6E 2F 70 65 72 6C 0A #!/usr/bin/perl.
00000010 75 73 65 20 73 74 72 69 - 63 74 3B 0A 75 73 65 20 use strict;.use
00000020 77 61 72 6E 69 6E 67 73 - 3B 0A 0A 70 72 69 6E 74 warnings;..print
00000030 20 22 48 65 6C 6C 6F 2C - 20 77 6F 72 6C 64 5C 6E "Hello, world\n
00000040 22 3B 0A ";.
The result comes back as a string. Each line of that result has the offset in the source chilling in the leftmost column, then one or more columns of data from the source in hexadecimal. The rightmost column of each line shows the printable characters β and every non-printable character gets shown as a single dot. No cap.
π¦ Functional Interface π¦
This module exports a single function, HexDump. You hand it a scalar value, and it returns a string containing the hexdump of the data you passed. That's the whole vibe.
π OO Interface π
First you construct a Data::HexDump object, then tell it where to get the data from, then generate the hex dump:
my $dh = Data::HexDump->new();
$dh->data($scalar); # dump the data in this scalar
$dh->fh($fh); # read this filehandle
$dh->file($filename); # read this file and dump contents
print while $_ = $dh->dump;
The different potential sources for data are considered in the order given above. So if you pass something to the data method, any subsequent calls to fh() or file() will have no effect. Periodt. π
π SEE ALSO π
Data::Hexify, by Johan Vromans β another simple option, similar to this module. Last release in 2004.Data::Hexdumper(by David Cantrell, DCANTRELL) β another hex dumper, with more features than this module.App::colourhexdump(by Kent Fredric, RIP) β provides a script which gives colourised output with character class highlighting.Data::HexDump::Rangeβ provides more functions, colour output, and the ability to skip uninteresting parts of the input data.Data::HexDump::XXDβ provides hex dumps like xxd. It doesn't say what xxd is, or provide a link, and there's no example output. But if you know and like xxd, this might be the one for you!Devel::Hexdumpβ provides some configuration options, but there are other more featured modules, and this one doesn't have example output in the doc.Data::Peekβ is a collection of functions for displaying data, includingDHexDumpwhich generates a simple hex dump from a string.String::HexConvertβ will convert ASCII strings to hex and reverse.
π AUTHOR π
Fabien Tassin <fta@oleane.net> β the icon who made this happen. π«Ά
π COPYRIGHT π
Copyright (c) 1998-1999 Fabien Tassin. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Bye bestie! This page is brought to you by perl v5.40.2, dated 2023-07-03, and it's the Data::HexDump(3) man page. Stay hexed πβ¨
π¦ where this page comes from
- alpine 3.22: perl-data-hexdump-doc 0.04-r1 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms