
japhy
Enthusiast
Jan 21, 2000, 7:38 AM
Post #2 of 3
(5374 views)
|
The problem is you're using the = operator, for assignment, instead of the =~ operator, for pattern matching. <BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR> if ($string = /[aieou]/i) { # $string is set to 1 or 0 # depending on whether or not $_ # has any vowels in it. # and if $string is set to 1, # then this if block gets executed } if ($string =~ /[aeiou]/i) { # if $string has any vowels in it, # then this if block gets executed } </pre><HR></BLOCKQUOTE>
|