DEV Community


Posted on • Updated on

What is X in Perl?

What is pip or gem?

cpanm or cpm

Where is my REPL?

Use perl debugger perl -de2 or one of the REPL (e.g. reply)

Is there any gemfile or requirements.txt?

cpanfile or cpmfile (NEW!)

(and more... e.g. with dzil)

What is package.json?

META.json and META.yml see doc

And gemfile.lock or package-lock.json?

cpanfile.snapshot or carton.lock

And what about Virtualenv?

Virtual envs are not as much vital in Perl, but there is plenv or perlbrew



Other tips for Perl beginners

  • Usually no variable methods (variable.method) but methods on variables (method(variable)) e.g. split
  • ; is mandatory (with few exceptions but please forget)
  • Indentation not meaningful

Top comments (7)

matthewpersico profile image
Matthew O. Persico

Indentation not meaningful

I prefer to describe this "Whitespace is not punctuation". Indentation is certainly meaningful for the readers of your code (which includes yourself after a few weeks on another project). For the love of Turing, INDENT your code. Given all the fancy-shmancy, shiny editors out there that will autoindent for you there is no reason not to indent. Just because you don't have to, doesn't mean you shouldn't. Especially if you are coming from a language that forces you to indent. Why drop that habit?

matthewpersico profile image
Matthew O. Persico

; is mandatory (with few exceptions but please forget)

A semicolon ends a statement. It's what allows multi-line statements to appear without annoying backslashes. The only place I remember that you don't need one is at the end of a block:

for (...) {

However, you frequently see this code:
funccall (

Notice the comma at the end of arg3? It's there so when you add arg4, It Just Works. So if you are willing to do that, put the semicolon after statement3 so that when you add statement4, It Just Works.

Don't be afraid of punctuation. We've been using it for hundreds of years and it has made reading so much easier; it does the same in programing.

grinnz profile image
Dan Book

Great recommendations. Some notes:

The author of Devel::REPL does not generally recommend it unless there is functionality you want that hasn't been written yet for Reply.

carton.lock is just the old name for cpanfile.snapshot and this is a Carton/cpm version pinning file, not really related to cpanfiles.

May be worth noting that META.json/META.yml are always autogenerated and should never be edited by hand.

raigaurav profile image
Gaurav Rai

Great article.
Some more -

What is NumPy in Perl(data science) ?

What is PyTorch/Apache MXNet in Perl (Machine learning and Deep learning) ?

What is IPython in Perl (Jupyter Networks)?

What is ggplot2 in Perl (data visualization package for the statistics) ?

What is Dash in perl (analytical web applications)?
Dash - in early stage

thibaultduponchelle profile image

Thank you !! 😃

matthewpersico profile image
Matthew O. Persico

This is a great article in both directions; it is just as useful for Perlers moving to Python. Thank you.

thibaultduponchelle profile image

Thank you for the kind words :)