Even after reading the standard documentation, I still can\'t understand how Ruby\'s Array#pack and String#unpack exactly work. Here is the example that\'s causing me the most t
The Array#pack
method is pretty arcane. Addressing question (2), I was able to get your example to work by doing this:
> ["61", "62", "63"].pack("H2H2H2")
=> "abc"
See the Ruby documentation for a similar example. Here is a more general way to do it:
["61", "62", "63"].map {|s| [s].pack("H2") }.join
This is probably not the most efficient way to tackle your problem; I suspect there is a better way, but it would help to know what kind of input you are starting out with.
The #pack
method is common to other languages, such as Perl. If Ruby's documentation does not help, you might consult analogous documentation elsewhere.