eval or something else

B

Bohne

if ($_ =~ /$EXPRESSION/$I)

My variable $I is either 'i' or ' '
How do I get perl to 'use' this value in the above?
 
A

anno4000

Bohne said:
if ($_ =~ /$EXPRESSION/$I)

My variable $I is either 'i' or ' '
How do I get perl to 'use' this value in the above?

You don't. The modifier in a match operator isn't subject to
interpolation. You can do this:

if ( /(?$I:abc)/ ) { ...

(No need to bind the match to $_, that's the default)

For this to work you must set $I to '' if you want case-sensitivity.
Blank isn't allowed in that position.

Anno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top