logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

String::HexConvert - Converts ascii strings to hex and reverse

Author

       Andreas Hernitscheck  ahernit(AT)cpan.org

Description

       It is a wrapper around pack and unpack of perl to convert a string of hex digits to ascii and other way
       around.

License

       You can redistribute it and/or modify it under the conditions of LGPL.

perl v5.38.2                                       2024-02-03                            String::HexConvert(3pm)

Methods

ascii_to_hex
        my $hex = ascii_to_hex($ascii);

       Converts a string to pairs of hex digits

   hex_to_ascii
        my $ascii = hex_to_ascii($hex);

       Converts pairs of hex digits to asci

Name

       String::HexConvert - Converts ascii strings to hex and reverse

Requires

       Exporter

See Also

       pack, unpack, Data::Translate

Synopsis

        use String::HexConvert ':all';

        print ascii_to_hex("hello world"); # writes: 68656c6c6f20776f726c64

        print hex_to_ascii("68656c6c6f20776f726c64"); # writes: hello world

Why?

       In know the comments like "is that realy needed?". IMHO yes, because I forget the exact syntax and
       possibilities of pack and unpack but hex_to_ascii tells me directly what pack "H*" does.

See Also