I just installed ActivePerl on Windows and have begun to learn Perl. In the book that I’m reading, the first code example is this:
#!/usr/bin/perl
use 5.010;
say "Hello, world!";
Since I’m on Windows, I was wondering if I need to include the first line?
I deleted the first line, and the program worked fine without it.
Is this line used just on Unix systems?
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
which turns warnings on by default (like
use warnings;but global).