Constants in Perl declared with use constant are actually subs. The regex in m/.../ first goes through double quoted string-ish interpolation, and the general way to interpolate a sub call within a string is:
$var = "foo @{[ sub() ]} baz";
# Note: This calls the sub in list context, so may have a
# different effect than if called in scalar context. Use
# ${ \sub() } for scalar context.
Also, the /e modifier is for the s/// operator, not the m// operator, hence the syntax errors you are getting.
So you would want something like:
print "attribute 0=\t$1\n" if m/@{[ATTRIBUTE_0]}='(.*)'/;
It looks kind of ugly, but it works. |