in reply to Search and Replace
$REx = qr{ \( (?: (?> [^()]+) | (??{ $REx }) )* \) }x; $str =~ s/($REx)/(my $a = $1) =~ tr!;!,!; $a/eg; [download]