Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!udel!haven.umd.edu!mimsy!prometheus!media!lighthouse!rob From: rob@lighthouse.com (Rob Kedoin) Newsgroups: comp.lang.perl Subject: pack and unpack Message-ID: <1991May15.205819.890@lighthouse.com> Date: 15 May 91 20:58:19 GMT Organization: Lighthouse Design, Ltd. Lines: 40 I was trying to use pack for the first time today and I can't get the following test program to do what I want: --- cut here --- #!/usr/bin/perl # packTest. Experiment with pack. # # Expected output was: # foo # bar # baz # # Actual output is: # f # b # b $struct = pack("aaa", "foo", "bar", "baz"); ($foo, $bar, $baz) = unpack("aaa", $struct); print "$foo\n"; print "$bar\n"; print "$baz\n"; --- cut here --- Does anyone know why I would only get the first character of the string and how to fix this. Just for reference, I'm running on a NeXT computer using Perl: "This is perl, version 4.0 $RCSfile: perl.c,v $$Revision: 4.0.1.1 $$Date: 91/04/11 17:49:05 $ Patch level: 3" Thanks in advance, Rob Kedoin rob@lighthouse.com Lighthouse Design, Ltd 6516 Western Avenue Chevy Chase, MD 20815