use Syntax::Construct qw{ /r }; sub newer { shift =~ s/^([^;]*;[^;]*;)(.*?=)([^;]*)(;.*)/"$1$2" . (' ' x length $3) . "$4;$3"/er }