in reply to Re^2: Uninitialized scalar inside a scalar?
in thread Uninitialized scalar inside a scalar?

You could to this with a little eval magic (see the caveats, later). What I have in mind would be something like the following:

if( $sampleData =~ /$searchString/ ) { print eval qq{"$outputString"}; }

The outer qq{} quote is used to generate an evaluateable string by adding double quotes around the original. When evaluated, this new string interpolates your variables into place.

There are a few problems with this approach:

You are basically trusting the incoming string to be safe to evaluate and run as code. This is not always a valid or safe assumption.

G. Wade