Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re: Updating a binary value in Net::LDAP

by NetWallah (Canon)
on Dec 31, 2012 at 16:06 UTC ( #1011070=note: print w/replies, xml ) Need Help??

in reply to Updating a binary value in Net::LDAP

If we call it an "octet string", instead of "binary", a concatenated octet string can be generated and stored like this (untested):
use Socket qw( inet_aton ); ... fileStore => join ('', map {inet_aton $_} @mynets),
This will be a concatenated string of 32-bit binary IP addresses (assuming IPv4), and can be written to a file.

             "By three methods we may learn wisdom: First, by reflection, which is noblest; Second, by imitation, which is easiest; and third by experience, which is the bitterest."           -Confucius

Replies are listed 'Best First'.
Re^2: Updating a binary value in Net::LDAP
by wardmw (Novice) on Jan 02, 2013 at 15:07 UTC
    Many thanks NetWallah,

    Looking at my original post I neglected to point out that the output sound have been a list of IP addresses with the text " OK" appended to each entry so the inet_aton() function was not going to work. However your suggestion to use the map() function was exactly what I needed and with your guidance the code below does what I need:

    fileStore => join ('', map {$_ .= "\tok\n" } @mynets),
    Just what I needed, thank you for your speedy response.


Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1011070]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2018-06-23 22:47 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.