Thread Perlfaq 6: How do I match a regular expression that's in a variable? , (1 answers)
Opened by Gast at 2009-10-15 08:10

Gast Gast
 2009-10-15 08:10
#126995 #126995
http://perldoc.perl.org/perlfaq6.html#How-do-I-mat...

zum vorletzten Beispiel:

Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;


my $string = 'abc123def456';

chomp( my $input = <STDIN> );

eval {
    if( $string =~ m/\Q$input\E/p ) { say ${^MATCH}; }
};

warn $@ if $@;


Was muss ich hier eingeben, damit ich eine Fehlermeldung bekomme?

View full thread Perlfaq 6: How do I match a regular expression that's in a variable? ,