replace() in Perl?

It’s as follows:

sub replace
{
	my($old,$new,$string)=@_;
	$string=~s/$old/$new/;
	return $string;
}

It should be called as follows:

print &replace($to_be_changed_from,$change_it_to,$full_string)

Leave a Reply