$_ = join '', ; # Add & to front of function calls without. s/&?(\w+\(.*?\))/&$1/g; # Add () to end of function calls without. s/(&\w+)(?:\((.*?)\))?/$1($2)/g; print; __DATA__ &somesub('args'); somesub('args'); &somesub;