in reply to What are multiple $_ =~ operations doing?
well sort of. What happens is that all the occurances of the string %HTTP_HOST% will be replaced with whatever is returned from &handleEnvVariable('HTTP_HOST') in $_, and THEN all the occurances of the string '%REMOTE_ADDR%' will be replaced with whatever is returned by &handleEnvVariable('REMOTE_ADDR')... and so on. . .
So in each line the string is modified by substitutions if the pattern exists in the line.
It could be shortened down to:
You might want to take a look at perlop(Regexp Quote-Like Operators) and perlre for more info.$_ =~ s/% (HTTP_HOST| (?:REMOTE_ (?:ADDR|PORT|USER)) %/&handleEnvVariable($1)/gex;