my $line = "root (hd1,1)"; my $match = qr/root \(hd[0-9],[0-9]\)/; if ($line =~ m/$match/is) { print "match 1 found \n"; }