Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^4: Peculiar problem with Net::LDAPS and AD LDAP

by jcb (Parson)
on Feb 21, 2021 at 04:32 UTC ( [id://11128614]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Peculiar problem with Net::LDAPS and AD LDAP
in thread Peculiar problem with Net::LDAPS and AD LDAP

Assuming that you need to change 'ABCD' into '\AB\CD', there should be an easier way:

sub enc_hex { my $out = unpack('H*', (shift)); $out =~ s/\G(..)/\\$1/g; return $out; }

This uses the regex engine to advance through the string two characters at a time, inserting backslashes before each pair in the output. See perlre and perlop for more details.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11128614]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (1)
As of 2024-04-18 23:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found