while ($content =~ m/<\?Function\(([^\)]*)\)\?>/g) { my $params = $1; my @params = $params =~ m/"([^"]*)"/g; my $line = some_param_stuff(@params); }