Use two $$.

if ( $line =~ /$$myVariable/ ) {
   &doSomethingSpiffy;
}

Dan Muey wrote:

If I do that won't it look for the 'value' of $variable?
I need it to find the actual string '$variable' not what $variable contains.
Any other ideas?

-----Original Message-----
From: Paul Johnson [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 14, 2003 9:12 AM
To: Dan Muey
Cc: Jenda Krynicky; [EMAIL PROTECTED]
Subject: RE: finding variable name in string



Dan Muey said:


To simplify the question and not get off track I need to see if a string contains a variable 'name' not 'value'.

If($string =~ m/\$variable/) { print "Yes \$variable exists"; }

Don't escape the $ in the RE.




--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to