To see the failure, run the script and do the following:use warnings; use strict; use Tk; my $string = "foobarbaz"; my $mw = MainWindow->new; my $regexp_entry = $mw -> Entry() -> pack; my $go_button = $mw -> Button( -takefocus => 1, -text => "Match using what you typed!", -command => sub{ my $exp = $regexp_entry -> get(); print STDOUT "I'm looking for a match for $exp...\n"; $string =~ m/$exp/ ? print STDOUT "match!\n" : print STDOUT "N +o match!\n"; } )-> pack; my $used_stored_exp = $mw -> Button( -text => "Match with Stored Regexp!", -command => sub{ my $exp = qr/foo/; print STDOUT "I'm looking for a match for $exp...\n"; $string =~ m/$exp/ ? print STDOUT "match!\n" : print STDOUT "N +o match!\n"; } )-> pack; $regexp_entry -> focus; MainLoop;
into the entry widget, press the "Match using what you typed!" button, and watch STDOUT.qr/foo/
into the entry widget.(?-xism:foo)
In reply to passing qr//'d regexp via Perl/Tk Entry widget by young_stu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |