[techtalk] Perl question

Kristina Pfaff-Harris kristina at linux.com
Thu Jun 22 15:10:02 EST 2000


On Thu, 22 Jun 2000, Stewart Larsen wrote:

> I think the slashes should be in the form "s/exp1/exp2/"

> >  if  ($string1 =~ /\*\s*\$string2|\$string2/)   

No, that's just if you're substituting!  This line basically says
"if the contents of $string1 contain '$string2'" and then, presumably,
you'd do something based on that.  I don't see the curly bracket required
by the "if" statement, and I also mentioned that it's looking ofor literal
"dollar-sign-string2" rather than the contents of the variable $string2
because of the backslashes, but that line is more or less syntactically
correct, although I'd expect the next line to have a curly bracket like
this: 

 if  ($string1 =~ /\*\s*\$string2|\$string2/)
   {
   print "something";
   }

Kristina






More information about the Techtalk mailing list