sub my_qx { my $string = shift; # do stuff to $string, like you would in your "overload" return qx{$string}; } my $variable = my_qx q{stuff};