I
I
igorgoldshteyn2018-03-13 22:05:12
Perl
igorgoldshteyn, 2018-03-13 22:05:12

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 answer(s)
A
Alexander Sapozhnikov, 2019-06-07
@shoorick

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;

Instead of the first of these lines, you can add a key -wwhen starting the pearl interpreter.
4. IDEs with pearl support exist. The best that I came across under Windows is Komodo IDE . There is a simplified free version - Komodo Edit: this is no longer an IDE (there is no debugger, unit tests and a bunch of other stuff), but just a fancy editor with pearl support.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question