Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: matching constants within a regular expression?

by matija (Priest)
on Mar 10, 2004 at 23:07 UTC ( [id://335652]=note: print w/replies, xml ) Need Help??


in reply to matching constants within a regular expression?

Two problems with your code
  • the e modifier does not work for matches (m//), only for substitutes (s///).
  • The @{ATTRIBUTE} form is incorrect (it even says to in the SOPW you pointed at)
The correct (i.e. no syntax errors, I can't vouch against logic errors) code is:
print "attribute 0=\t$1\n" if m/${\ATTRIBUTE_0}='(.*)'/; print "attribute 1=\t$1\n" if m/${\ATTRIBUTE_1}='(.*)'/;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 04:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found