http://www.perlmonks.org?node_id=1002549


in reply to How to get at perl's options in a program

If you want to do it on a *nix variant, you could use $$ in conjuction w/ ps, like:
~$ perl -e 'print `ps -o args -p $$`' COMMAND perl -e print `ps -o args -p $$`
And the grab flags off that. Honestly, though, this smells of an XY Problem. What are you actually trying to accomplish? There are cleaner, cross-platform ways of testing for individual flags. And this method will miss flags in the hashbang.

#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.