View Single Post
Old Jun 20th, 2006, 2:51 PM   #1
Blackwolf189
Newbie
 
Join Date: May 2005
Posts: 10
Rep Power: 0 Blackwolf189 is on a distinguished road
Determining a negative match

Hey i have a program where i needed to determine if something didnt match.
I originally tried using !=~ but no matter how many times i entered the string to match, it wouldnt work. i eventually replaced it with the not on the outside of the match and it now works. I would like to know why did !=~ fail to do what i wanted.

This doesnt Work
 
$k = ""
while ($k !=~ /hello/i)
{
    $k = <STDIN>;
}

This Works
$k = ""
while (!($k =~ /hello/i))
{
    $k = <STDIN>;
}

My question is whats the difference
Blackwolf189 is offline   Reply With Quote