http://www.perlmonks.org?node_id=416143


in reply to Passing regexp as argument

Pass string and the replacement as 2 arguments:

$obj->changeName($topNodeOfXmlTree, 'WrongNode', 'RightNode'); sub changeNodeNames { my ($self,$node,$from,$to) = @_; my $nodeName = $node->nodeName; $nodeName =~ s/$from/$to/; ... }
--
edan