I want to reproduce the output of the unix utility hexdump -C.
sub hexdump($data) { $data =~ s/\G(?| ( \0{16} )+ (?{ '*' }) | ( .{1,16} ) (?{ sprintf '%08X %-50s|%-16s|', $-[1], join(' ', unpack('(H2)8a0(H2)8', $1)), $1 =~ tr{[\0-\x1F\x7F-\xFF]}{.}r }) )/$^R\n/xgr; }
Do any fellow monks see opportunities for additional savings? Obviously whitespace can be removed, but I'm leaving it in for ease of discussion.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: hexdump -C
by tybalt89 (Monsignor) on Oct 13, 2025 at 15:25 UTC | |
by NERDVANA (Priest) on Oct 13, 2025 at 15:49 UTC | |
|
Re: hexdump -C
by ikegami (Patriarch) on Oct 14, 2025 at 01:22 UTC | |
by NERDVANA (Priest) on Oct 14, 2025 at 05:15 UTC | |
by harangzsolt33 (Deacon) on Oct 15, 2025 at 14:07 UTC | |
by ikegami (Patriarch) on Oct 15, 2025 at 14:15 UTC | |
by harangzsolt33 (Deacon) on Oct 15, 2025 at 14:25 UTC | |
|