in reply to Perl inline replace with execution results
If you run it without /e you will notice the string becomes `printhi`. Now you want to eval this expression and the /e takes care of that.
This works for me
#!/usr/bin/perl use strict; use warnings; my $str = "printmeprinthi"; $str =~ s/printme(.*)$/`$1`/e; print $str,$/;
my printhi program is
#!/bin/sh echo hi
output
hi
|
---|