#! /usr/bin/perl use strict; use warnings; my $TMP = "asdf"; my $search = 'command'; my $string = '`command -option $TMP`'; $string =~ /(`$search([^`]*)`)/; my $match = $1; print "erkannter String: $match "; print (($string =~ m/(\Q$match\E)/ ) ? "Regexp-Match: $match " : "kein Match ");