Bootstrap FreeKB - Perl (Scripting) - Running commands inline
Perl (Scripting) - Running commands inline

Updated:   |  Perl (Scripting) articles

Almost always, Perl is run as a script. For example, example.pl has the following.

#!/usr/bin/perl
use strict;
use warnings;
print "Hello World\n";

 

Running this script should output Hello World.

~]# perl example.pl
Hello World

 

Sometimes, you may want (or need) to run Perl on the command line. The -e option can be used to "execute" Perl commands on the command line.

~]# /usr/bin/perl -e "use strict; use warnings; print 'Hello World\n';"
Hello World

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter e239ba in the box below so that we can be sure you are a human.