Few things:
1. The problem isn't Perl not being in the path--your error msg isn't from Powershell, it's from perl.exe. The problem is that Perl can't find the script. The answer may be as simple as quoting the path to the script, or it may be more complicated.
2. Since the path is going to be dynamically generated by your script, you should probably pull it out into a variable which you can then get into a loop. e.g.
$id = 'xxx' # insert an actual one here
$domain = 'foo' # and here
$script="D:\Inetpub\Web\$id\stats.$id.$domain.gov\wwwroot\cgi-bin\awstats.pl"
perl $script -config="extranet.$id.gov" -update
Try something like that and let us if it errors out and what error you get. Then you can work on the code to create those variables above. That might be something like
$domains = Get-ChildItem D:\Inetpub\Web\ | where-object { $_.PsIncontainer }
$domains | foreach-object {
$domain = $_
# then the above code
}
3. Triple quotes? That may work but did you work that out logically or by trial and error?

That may be able to be improved upon. I got the following to work with zero quotes, and the variable definitely has some spaces in it. *and*, it's passing it to a 16-bit executable.
cmd /c edit $profiledir\profile.ps1