Do I need to include #!/usr/bin/perl line in Perl script on Windows?

If you want the script to be portable to UNIX and Cygwin, keep the shebang line. Even on Windows where the OS doesn’t use it to determine how to run the file, Perl will still parse switches written there, such as

#!/usr/bin/perl -w

which turns warnings on by default (like use warnings; but global).

Leave a Comment