http://qs321.pair.com?node_id=11114743

Cornichon has asked for the wisdom of the Perl Monks concerning the following question:

Hello everyone,

I'm writing a script that receives as a parameter the name of a user and performs a search in LDAP but I can't find a way to use a Perl variable in the LDAP search filter.

The code used for the search is this one:

$value = $ldap->search( base => 'dc=xxdom,dc=xxdc', scope => 'sub', filter => '(sn="xx")', );

Let's say the variable $name contains the name I need to do the search.

I tried this: filter => '(sn = $name)'.

It's not working, does anyone have a solution for me?