home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / lang / perl / 5515 < prev    next >
Encoding:
Internet Message Format  |  1992-08-26  |  1.4 KB

  1. Path: sparky!uunet!dtix!darwin.sura.net!convex!convex!tchrist
  2. From: tchrist@convex.COM (Tom Christiansen)
  3. Newsgroups: comp.lang.perl
  4. Subject: Re: easy question?: substrings
  5. Message-ID: <1992Aug26.222821.28341@news.eng.convex.com>
  6. Date: 26 Aug 92 22:28:21 GMT
  7. References: <1992Aug26.213516.22813@cbnewse.cb.att.com>
  8. Sender: usenet@news.eng.convex.com (news access account)
  9. Reply-To: tchrist@convex.COM (Tom Christiansen)
  10. Distribution: usa
  11. Organization: Convex Computer Corporation, Colorado Springs, CO
  12. Lines: 21
  13. Originator: tchrist@pixel.convex.com
  14. Nntp-Posting-Host: pixel.convex.com
  15. X-Disclaimer: This message was written by a user at CONVEX Computer
  16.               Corp. The opinions expressed are those of the user and
  17.               not necessarily those of CONVEX.
  18.  
  19. From the keyboard of budnick@cbnewse.cb.att.com (Mary Jo Budnick):
  20. :Hi!  I just started to use Perl and can't find the info in the
  21. :Wall/Schwartz book very easily to solve my problem.  Help me out?
  22. :
  23. :All I want to do is to change a string in the format of either
  24. :    0xffffff00 or ffffff00 into the format
  25. :    of 255.255.255.0 
  26.  
  27. Try:
  28.  
  29.     $n = "ffffff00";
  30.     print join(".", unpack(C4, pack(L, hex($n)))), "\n";
  31.  
  32. Add quotes around the format strings for old versions of perl.
  33.  
  34. --tom
  35. -- 
  36.     Tom Christiansen      tchrist@convex.com      convex!tchrist
  37.  
  38.     Hey, I had to let awk be better at *something*...  :-)
  39.             --Larry Wall in <1991Nov7.200504.25280@netlabs.com>1
  40.