in reply to passing qr//'d regexp via Perl/Tk Entry widget
...``=~'' binds a scalar expression to a pattern match. ... (If the right argument is an expression rather than a search pattern, substitution, or transliteration, it is interpreted as a search pattern at run time.
#!/usr/bin/perl -w use strict; my $string = "foobarbaz"; my $exp = "foo"; if($string =~ $exp){ print "without /'s works fine"; }elsif($string =~ /$exp/){ print "with /'s is needed"; }else{ print "WTF!??"; }
-InjunJoelwithout /'s works fine
|
|---|