I don't know of any good Perl to Powershell comparisons but I can answer your secondary question.
$files = get-childitem "c:\test\" -filter *.dll
foreach ($file in $files) { $file.Name }
There are two different ways you can express a foreach
loop in Powershell.
You can pipe an array of objects into foreach
and $_
becomes the current object on each iteration.
0,1,2,3 | foreach { $_ }
Alternatively, you can pass a variable to iterate over.
foreach ($num in 0,1,2,3) { $num }
Output in both cases.
0
1
2
3