Achal Neupane
Achal Neupane

Reputation: 5719

Perl in terminal takes long time to load

I am new to perl and wanted to run it from Ubuntu terminal, so I just typed perl. It is taking forever to load it. What do I need to do? To make sure perl is installed I typed:

 perl -v

This is perl 5, version 18, subversion 2 (v5.18.2) built for x86_64-linux-gnu-thread-multi
(with 41 registered patches, see perl -V for more detail)

Copyright 1987-2013, Larry Wall

Upvotes: 1

Views: 365

Answers (1)

Quentin
Quentin

Reputation: 944320

If you just type perl then it will expect to receive a script from STDIN.

It isn't taking forever to load. It is waiting for you to type a Perl program.

It generally isn't desirable to type directly into STDIN (since your code isn't saved and you have limited ability to correct mistakes).

Write your program in a text file and then specify that file as the argument.

perl myScript.pl

or, having made sure you start the script with an appropriate shebang line (#!/usr/bin/env perl), and made it executable (chmod +x myScript.pl), execute it directly:

./myScript.pl

If you were looking for a Python-style REPL then you can use CPAN to install Devel::REPL and start it with:

re.pl

re.pl in action

Upvotes: 7

Related Questions