[LIP] Perl pack() question

Binand Sethumadhavan <[email protected]>
Newsgroups gmane.user-groups.linux.india.programmers
Message-ID <[email protected]>
This ought to be simple. I have this snippet:

my @octets = split (/\./, $ip);
foreach $o (@octets) {
    printf "%02X", $o;
}

(ie, take an IP address and get it as a string of four Hex numbers. This
is to create PXE installation config files - lots of them).

Is there a way to rewrite the stuff in the foreach loop using pack()? I
am sort of unfamiliar with the pack() :)

Binand

-- 
Hanlon's Razor: Never attribute to malice that which can be adequately
explained by stupidity.
Bruce's Razor: Never attribute to stupidity that which can be adequately
explained by Microsoft funding.


-------------------------------------------------------
This SF.Net email is sponsored by The 2004 JavaOne(SM) Conference
Learn from the experts at JavaOne(SM), Sun's Worldwide Java Developer
Conference, June 28 - July 1 at the Moscone Center in San Francisco, CA
REGISTER AND SAVE! http://java.sun.com/javaone/sf Priority Code NWMGYKND
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.