home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!dtix!darwin.sura.net!convex!convex!tchrist
- From: tchrist@convex.COM (Tom Christiansen)
- Newsgroups: comp.lang.perl
- Subject: Re: easy question?: substrings
- Message-ID: <1992Aug26.222821.28341@news.eng.convex.com>
- Date: 26 Aug 92 22:28:21 GMT
- References: <1992Aug26.213516.22813@cbnewse.cb.att.com>
- Sender: usenet@news.eng.convex.com (news access account)
- Reply-To: tchrist@convex.COM (Tom Christiansen)
- Distribution: usa
- Organization: Convex Computer Corporation, Colorado Springs, CO
- Lines: 21
- Originator: tchrist@pixel.convex.com
- Nntp-Posting-Host: pixel.convex.com
- 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.
-
- From the keyboard of budnick@cbnewse.cb.att.com (Mary Jo Budnick):
- :Hi! I just started to use Perl and can't find the info in the
- :Wall/Schwartz book very easily to solve my problem. Help me out?
- :
- :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
-
- Try:
-
- $n = "ffffff00";
- print join(".", unpack(C4, pack(L, hex($n)))), "\n";
-
- Add quotes around the format strings for old versions of perl.
-
- --tom
- --
- Tom Christiansen tchrist@convex.com convex!tchrist
-
- Hey, I had to let awk be better at *something*... :-)
- --Larry Wall in <1991Nov7.200504.25280@netlabs.com>1
-