How does pack() and unpack() work in Ruby
问题 In Ruby why we need array Packing ? How does directive help to do such packing? I ran some code in my console to see what and how directives looks like in Array packing.But the output is closely same with each directives. Then in core how they differs? irb(main):003:0> n = [ 65, 66, 67 ] => [65, 66, 67] irb(main):004:0> n.pack("ccc") => "ABC" irb(main):005:0> n.pack("C") => "A" irb(main):006:0> n.pack("CCC") => "ABC" irb(main):007:0> n.pack("qqq") => "A\x00\x00\x00\x00\x00\x00\x00B\x00\x00