software






 

Question by  xeroblade56 (97)

What is the tilde operator in the Perl language?

I've seen this written, but am not sure what it does.

 
+6

Answer by  angille (55)

It is used to run regular expressions, following = to return true on a match and following! to return false on a match. Examples: $foo = "string of letters"; $foo =~ /string/; # true $foo =~ /other/; # false $foo! ~ /other/; # true $foo =~ s/ /_/g; # $foo is now "string_of_letters"

 
You have 50 words left!