I am running Strawberry perl on Windows 10 from either Powershell or the CMD prompt. With CMD, you can change perl's available features on the command line with the -M
option, followed by a version number, like this (to enable 'say', for example):
D:\>echo hello world |perl -M5.20.0 -ne "chomp; s/ll/rr/; say"
herro world
D:\>
With Powershell, the -M
option eats the initial version number and looks for a script following it:
PS D:\> echo "hello world" |perl -M5.20.0 -ne "s/ll/rr/; say"
Can't open perl script ".20.0": No such file or directory
PS D:\>
The CMD behaviour is what I would expect and is also what bash gives me.
Why is Powershell different and how can I use the -M<version#>
feature in Powershell?