|We don't bite newbies here... much|
OS agnostic C&P CLI snippets with -Eby LanX (Sage)
|on Oct 17, 2021 at 18:25 UTC||Need Help??|
LanX has asked for the wisdom of the Perl Monks concerning the following question:
we often exchange one-liners here or short snippets like the following.
unfortunately this sucks on Win/CMD because it doesn't like simple quotes°
The best OS agnostic approach - well the only I'm aware of - is typing to STDIN with a final __END__
So far so good ... (well it's not so good for in-place editing but then a temp file might be better anyway)
But did you notice the -M5.012 I had to add? It means use 5.012 and it's there to compensate the -E which activated all current features. But simply using -E will deactivate reading from STDIN and say was added with 5.12 ... (details perlrun )
Question: Is there a shorter way to do this?
°) the truth is even far worse. One needs to replace the surrounding ' with " and all internal "..." with qq(...) and worry about the right delimiter.