home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5530 < prev    next >
Encoding:
Text File  |  1992-08-26  |  881 b   |  27 lines

  1. Newsgroups: comp.lang.perl
  2. Path: sparky!uunet!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!dhami
  3. From: dhami@cs.ubc.ca (Mandeep S Dhami)
  4. Subject: A comparison (was simple question?)
  5. Message-ID: <1992Aug27.035605.9848@cs.ubc.ca>
  6. Sender: usenet@cs.ubc.ca (Usenet News)
  7. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  8. Date: Thu, 27 Aug 92 03:56:05 GMT
  9. Lines: 16
  10.  
  11. Purely out of curiosity:
  12.  
  13. $x="ffefab30";
  14. $y=join(".",grep($_=hex,unpack("a2a2a2a2",$x)));
  15. $y=join(".", unpack("C4", pack("N", hex($x))));  <-- 17% faster (of 1000 iter.)
  16.  
  17. # After all it has 4 fn. calls compared to 7 in 1st (though hex is
  18. # quicker than others).
  19.  
  20. Mandeep.
  21.  
  22. --
  23. __________________________________________________________________
  24. "I'm very brave generally," he went on in a low voice:
  25. "only to-day I happen to have a headache."
  26.                                       -- Lewis Carroll
  27.