Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Problem with ampersand and regex

by davido (Archbishop)
on Dec 19, 2012 at 19:51 UTC ( #1009620=note: print w/ replies, xml ) Need Help??


in reply to Problem with ampersand and regex

use warnings;: "Possible unintended interpolation of @123..."

Use single quotes: my $line = 'mail: asdf@123.com'; and see if that clears it up for you.

use strict; doesn't catch this one because it treats "digit" variables special, and allows them without declaration.


Dave


Comment on Re: Problem with ampersand and regex
Select or Download Code
Re^2: Problem with ampersand and regex
by Anonymous Monk on Dec 19, 2012 at 20:21 UTC
    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.

      How are you filling @array?


      Dave

        It is being filled by the output of a system call to ldapsearch. Thank you.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (16)
As of 2014-09-22 14:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (195 votes), past polls