Update: Also see HexView by OeufMayo.
sub hdump { my $offset = 0; my(@array,$format); foreach my $data (unpack("a16"x(length($_[0])/16)."a*",$_[0])) { my($len)=length($data); if ($len == 16) { @array = unpack('N4', $data); $format="0x%08x (%05d) %08x %08x %08x %08x %s\n"; } else { @array = unpack('C*', $data); $_ = sprintf "%2.2x", $_ for @array; push(@array, ' ') while $len++ < 16; $format="0x%08x (%05d)" . " %s%s%s%s %s%s%s%s %s%s%s%s %s%s%s%s %s\n"; } $data =~ tr/\0-\37\177-\377/./; printf $format,$offset,$offset,@array,$data; $offset += 16; } }
map {$_ = sprintf('%2.2x',$_)} @array; [download]
$_ = sprintf "%2.2x", $_ for @array; [download]
-- Randal L. Schwartz, Perl hacker
Your first Perl Book - the first one ever Average number of caffeinated beverages per work day - the poll with the highest participation My Thoughts on the New Voting/Experience System - the poll with the fewest votes cast When I grow up, I want to be: - one of the polls with the fewest options Perl 6 will primarily be: - the first one on Perl6 When I see a poll - one of the many polls about polls this poll ;-) yet to come none - I hate polls. Bah. some other
Results (49 votes), past polls