You need qr here and escape right paranthesis. Also have a look at perlre.
my $line = "root (hd1,1)"; my $match = qr/root \(hd[0-9],[0-9]\)/; if ($line =~ m/$match/is) { print "match 1 found \n"; }
updated: changed qw to qr. Zaxo++ Thanks.
Prasad
In reply to Re: Regex from string
by prasadbabu
in thread Regex from string
by rimmern
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |