For the curious, Perl’s -x flag is designed for embedding scripts inside larger files. It tells Perl to ignore every single line in the script until it reaches a line starting with #! and containing the string perl. This detail can be found in the perlrun manpage. Perl also allows for non-code data to appear after the block of code: you can tell Perl to stop parsing the file by putting __END__ on its own line.

On the other hand, Python’s -x flag does exactly one thing: ignoring the first line of code. Note that using it would cause line numbers in stack traces to be off by one, which is not ideal. This is stated in the Python documentation.