home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / perl / 5832 < prev    next >
Encoding:
Internet Message Format  |  1992-09-09  |  1.1 KB

  1. Path: sparky!uunet!pipex!demon!cix.compulink.co.uk!pmoore
  2. Newsgroups: comp.lang.perl
  3. From: pmoore@cix.compulink.co.uk (Paul Moore)
  4. Subject: Use of 'b' templates
  5. Reply-To: pmoore@cix.compulink.co.uk
  6. Date: Wed, 9 Sep 1992 23:21:00 +0000
  7. Message-ID: <memo.619212@cix.compulink.co.uk>
  8. Sender: usenet@gate.demon.co.uk
  9. Lines: 24
  10.  
  11. The subject says it, really. Can somebody tell me how 'b' and 'B' templates
  12. work, in pack() and unpack()? Preferably with a few examples to make things
  13. clear.
  14.  
  15. I have just struggled to an understanding of vec(), but 'b' is beyond me...
  16.  
  17. [NB: if it matters for examples, my machine stores bytes such that
  18.  
  19.    for $i (0..15)
  20.    {
  21.       print vec('31',$i,1) ? '1' : '0';
  22.    }
  23.  
  24. gives 1100110010001100]
  25.  
  26. Thanks in advance for any help...
  27.  
  28. Gustav.
  29.  
  30. ---------------------------------------------------------------------------
  31. Paul Moore (pmoore@cix.compulink.co.uk)   |
  32. ---------------------------------------------------------------------------
  33. Rimmer directive #271 states just as clearly "No chance, you metal bastard"
  34. ---------------------------------------------------------------------------
  35.