in reply to What are multiple $_ =~ operations doing?
$_ is the first argument to the function. The binding operator (=~) followed by s/// performs substitutions. The ge at the end says to do the subtitutions how many time it cans ("g") and that the subtitution value should be evaluated ("e").
So, you are substituting "%HTTP_HOST%" by the result of calling the "handleEnvVariable" function.
If you don't like it that way, you can always:
or (but be careful, it can not work in case there are other variables)$_ =~ s/%(HTTP_HOST|REMOTE_ADDR|REMOTE_PORT|REMOTE_USER)%/handleEnv +Variable($1)/ge;
$_ =~ s/%([A-Z_]+)%/handleEnvVariable($1)/ge;