If you want to do it on a *nix variant, you could use $$ in conjuction w/ ps, like:
in reply to How to get at perl's options in a program
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.
~$ perl -e 'print `ps -o args -p $$`'
perl -e print `ps -o args -p $$`
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.