We don't bite newbies here... much | |
PerlMonks |
Re: Could some explain =~ vs !~ to me?by krusty (Hermit) |
on May 08, 2004 at 02:52 UTC ( [id://351672]=note: print w/replies, xml ) | Need Help?? |
Zaxo is right with his explanation, but what I don't understand is your output. I would expect the last line of output to be WooWoo Using your last few lines of code here's my output using perl 5.8.3
What happens is that the negated pattern bind operator substitutes the first capital "H" it finds in "WooHoo". I am evaluating whether the substitution was *not* successful, but since I do nothing with the result I get a the void warning. Since my string has changed I now print "WooWoo". I would have expected your code to print "WooWoo" too. I'm going to quit now because this sounds a bit too much like a Dr. Seuss book. Cheers, Kris Thanks duff. I see now what the problem is. In my code, I'm taking only a few snippets of the original code. If I take the whole code, I'm working on the modified string "HooHoo" at the time, and would need a /g modifier to get both "H"'s
In Section
Seekers of Perl Wisdom
|
|