Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re^2: Problem with ampersand and regex

by Anonymous Monk
on Dec 19, 2012 at 20:21 UTC ( #1009626=note: print w/ replies, xml ) Need Help??

in reply to Re: Problem with ampersand and regex
in thread Problem with ampersand and regex

It looks like it trying to make the question overly simple, I made the mistake of omitting something very important. The definition of $line is coming from looping through an array as in the following:

foreach my $line (@array) { . . . }
With that in mind, how can I define $line with single quotes? Sorry for the mistake.

Comment on Re^2: Problem with ampersand and regex
Download Code
Replies are listed 'Best First'.
Re^3: Problem with ampersand and regex
by davido (Archbishop) on Dec 19, 2012 at 20:24 UTC

    How are you filling @array?


      It is being filled by the output of a system call to ldapsearch. Thank you.
        What if you use backticks (`ldapsearch`) instead of system("ldapsearch"). When I put mail: in a file and called @array = `cat file`, your script worked, but not when using @array = system("cat file").

        Take a look at What's the difference between Perl's backticks, system, and exec?. The system() call returns the exit status, not the actual result (STDOUT) of the command like the backtick operator does.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2015-11-27 00:45 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (710 votes), past polls