Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!julius.cs.uiuc.edu!psuvax1!news From: flee@dictionopolis.cs.psu.edu (Felix Lee) Newsgroups: comp.lang.perl Subject: Re: Why are my digits disappearing? Message-ID: Date: 5 Dec 90 11:13:19 GMT References: <136559@pyramid.pyramid.com> Sender: news@cs.psu.edu (Usenet) Organization: Penn State Computer Science Lines: 22 Nntp-Posting-Host: dictionopolis.cs.psu.edu It looks like a Perl bug (tm). Consider this fragment: for (1..3) { for $k (0..7) { $x = (1..4, 'a'..'d')[$k]; print $x; } print "\n"; } This prints 1234abcd 1234 1234 There's a number of different workarounds, but if you just want an &IPTOHEX subroutine, this should do: sub IPTOHEX { local(@ip) = @_; sprintf('%02X' x 4, @ip); } -- Felix Lee flee@cs.psu.edu Brought to you by Super Global Mega Corp .com