home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.perl
- Path: sparky!uunet!cs.utexas.edu!convex!convex!tchrist
- From: Tom Christiansen <tchrist@convex.COM>
- Subject: Re: easy question?: substrings
- Originator: tchrist@pixel.convex.com
- Sender: usenet@news.eng.convex.com (news access account)
- Message-ID: <1992Aug26.224028.29064@news.eng.convex.com>
- Date: Wed, 26 Aug 1992 22:40:28 GMT
- Distribution: usa
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- References: <1992Aug26.213516.22813@cbnewse.cb.att.com> <1992Aug26.222821.28341@news.eng.convex.com>
- Nntp-Posting-Host: pixel.convex.com
- Organization: Convex Computer Corporation, Colorado Springs, CO
- X-Disclaimer: This message was written by a user at CONVEX Computer
- Corp. The opinions expressed are those of the user and
- not necessarily those of CONVEX.
- Lines: 21
-
- From the keyboard of tchrist@convex.COM (Tom Christiansen):
- ::All I want to do is to change a string in the format of either
- :: 0xffffff00 or ffffff00 into the format
- :: of 255.255.255.0
-
- : $n = "ffffff00";
- : print join(".", unpack(C4, pack(L, hex($n)))), "\n";
- :
- :Add quotes around the format strings for old versions of perl.
-
- Blech. Doesn't work on a DECstation. Byte order foo. Use this instead:
-
- print join(".", unpack("C4", pack("N", hex($n)))), "\n";
-
- --tom
-
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
- There is, however, a strange, musty smell in the air that reminds me of
- something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
- --Larry Wall in Configure from the perl distribution
-