#!/bin/perl -p # basic substitution # processing the field method is easy s/((\$\w+)->field\b/$1\->\{field\}/g; # the set_field method has an argument, capture it s/s/(\$\w+)->set_field\(([^)]*)\)/$1\->\{field\}= $2/g