Disclaimer: I'm new to perl (just started doing work with it a week
ago), so perhaps I'm either making this more complicated than it needs
to be, or I'm doing something that *is* complicated, and I don't know
where to start.
I wrote a script to query our Hosts OU. The output will be IP then
Hostname. The code I have right now to print the results is:
foreach $result ($mesg->sorted(ipHostNumber)) {
$cn = $result->get_value('cn');
$ip = $result->get_value('ipHostNumber');
write;
}
However, as you can imagine, the output I get is machine sorted -
[EMAIL PROTECTED]:~/views/ldap-utils$ ./hlookup -i x.y.z.*
IP HOST
x.y.z.109 hosta
x.y.z.11 hostb
x.y.z.110 hostc
x.y.z.111 hostd
Is there an easy way to make this do some sort of "natural sort?" I
tried substituting Sort::Naturally's 'ncmp' function in
Net/LDAP/Search.pm but it didnt do anything. I tried a few other things
involving hash functions (it seems that $mesg->entries returns a hash,
according to some print output I've experimented with), but no dice
there either.
If anyone could point me in the right direction on how to do what I'm
trying to do, I'd be very appreciative.
--
// Patrick Cable II
// LLCAD System Administrator Co-Op
// 781-981-5996 - [EMAIL PROTECTED]