in reply to Variable in regexp
my $var = "only"; my $str = "only_once"; if($str =~ /($var)\_(.*)/) { print "$1\t$2\n"; } [download]