Answer the question
In order to leave comments, you need to log in
How to run a Perl program on Windows?
I recently started learning Perl. I can't figure out how to run programs correctly. I run perl files via the command line.
I can't understand what is :"#!/usr/bin/perl"
Programs run even without this line at the beginning of the code.
Also wanted to ask how to fire inline warnings in Perl?
There must be something like an IDE for Perl.
Answer the question
In order to leave comments, you need to log in
1. There are many ways: you can write by hand путь/к/перлу/perl скрипт.pl
(more precisely, you can have something like C:\Program Files\Some Perl\bin as a path), you can add the path to the perl to the environment variable %PATH%
and run scripts with the command perl скрипт.pl
, you can configure association of pearl sources with an interpreter - there are a lot of options. And there was once cygwin, where of course there was a pearl, and in the latest versions of Windows 10 there is a Linux subsystem, where a pearl should also be.
2. #!/usr/bin/perl
- the so-called shebang, a special comment, where after the hash mark with an exclamation point, the path to the interpreter is written (it can be not only a pearl) and, if necessary, additional parameters (for example,#!/usr/bin/perl -F' ' -nla
). In Unix-like systems, this matters - when you run the script without specifying the command to call the interpreter, the operating system just looks in the shebang to understand how to execute the script - there are scripts without extensions. Under Windows shebang most likely does not play a role.
3. To make the pearl swear more, use
use warnings;
use strict;
-w
when starting the pearl interpreter. Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question