Data::Hexify(3)
๐ Data::Hexify โ the manual page, but make it cute ๐
okay bestie, gather round, because we're talking about Data::Hexify, a lil Perl module from the User Contributed Perl Documentation corner of the man-verse. It's giving "hexdump but make it a subroutine," and honestly? iconic. โจ
๐ธ NAME ๐ธ
Data::Hexify โ a Perl extension for hexdumping arbitrary data. yes, arbitrary. binary chaos welcome. ๐ฆ
โจ SYNOPSIS โจ
the whole vibe in three lines:
use Data::Hexify;
print STDERR Hexify(\$blob);
that's it. that's the whole thing. slay. ๐
๐ DESCRIPTION ๐
so this module exports exactly one subroutine, and its name is Hexify. one job, does it well, main character energy only. ๐
Hexify takes arbitrary data (possibly binary, possibly cursed, possibly both) and formats it into something suitable for hex dumps, in the style of xd or hexl. no cap.
the first, or only, argument to Hexify is the data you wanna hexify โ or a reference to that data. and Hexify hands you back a string that prints like this:
0000: 70 61 63 6b 61 67 65 20 44 61 74 61 3a 3a 48 65 package Data::He
0010: 78 69 66 79 3b 0a 0a 75 73 65 20 35 2e 30 30 36 xify;..use 5.006
and so on, forever, the way that it just keeps going. ๐
breaking down the anatomy of each line, because i know you wanna know:
- on the left โ the hexadecimal index of the data ๐ข
- then โ a bunch of hex bytes
- then โ the actual chunk of data, except all the unprintables got swapped out for periods ๐
๐ซถ the optional second argument ๐ซถ
the optional second argument to Hexify must be a hash or a hash reference, and it holds values for any of these parameters. this is the customization menu, bestie, order whatever you want:
firstโ the first byte of the data to be processed. default is to start from the beginning of the data. ๐ฑlengthโ the number of bytes to be processed. default is to proceed all data. yes, all of it. greedy behavior, love that for us. ๐chunkโ the number of bytes processed per line of output. default is16. ๐groupโ the number of bytes grouped together. default is1(which means no grouping, just vibes). if you do use it, heads up: it must be a divisor of the chunk size. math said so, not me. ๐งฎduplicatesโ when set, duplicate lines of output get suppressed and replaced by a single line that reads**SAME**. duplicate suppression is enabled by default. ๐showdataโ a reference to a subroutine used to produce a printable string from a chunk of data. by default, the subroutine used replaces unwanted bytes with periods.
the subroutine gets the chunk of data passed as its argument, and it should return a printable string of at most chunksize characters. ๐จ
alignโ align the result tochunksizebytes. this only matters when you're processing data that does not start at the beginning. for example, whenfirstis10, the result would become:
0000: ... 74 61 3a 3a 48 65 ta::He
0010: 78 69 66 79 3b ... 65 20 35 2e 30 30 36 xify;..use 5.006
... and so on ...
alignment is on by default. without alignment, the result would be:
000a: 74 61 3a 3a 48 ... 79 3b 0a 0a 75 73 65 ta::Hexify;..use
001a: 20 35 2e 30 30 ... 73 65 20 73 74 72 69 5.006;.use stri
... and so on ...
๐ฆ
startโ pretend that the data started at this byte (while in reality it starts at bytefirst). the example above, withstart => 0, becomes:
0000: 74 61 3a 3a 48 ... 79 3b 0a 0a 75 73 65 ta::Hexify;..use
0010: 20 35 2e 30 30 ... 73 65 20 73 74 72 69 5.006;.use stri
... and so on ...
๐
๐ SEE ALSO ๐
Data::DumperYAML
go read those too, bestie, knowledge is free and it's giving scholar. ๐โจ
๐ AUTHOR ๐
Johan Vromans, <jvromans@squirrel.nl> โ absolute legend, we stan. ๐ซถ
๐ COPYRIGHT AND LICENSE ๐
Copyright (C) 2004 Squirrel Consultancy
this library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.6.0 or, at your option, any other version of Perl 5 you may have available. so generous, so giving. ๐
ok that's the whole page, no details left behind, every flag accounted for, periodt. ๐
and that's a wrap on Data::Hexify, documented under perl v5.42.0, dated 2025-07-25. tysm for reading, mwah, go hexdump something cursed. ๐๐โจ๐ฆ
๐ฆ where this page comes from
- fedora 43: perl-Data-Hexify 1.00-40.fc43 ยท GPL-1.0-or-later OR Artistic-1.0-Perl
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms