Hello Cruel Perl

touch helloperl.pl

Open helloperl.pl and paste the following in there:

print "Hello Cruel Perl\n";

Make sure you have executable permissions for helloperl.pl. Then run:

perl helloperl.pl

Similar Articles:

One comment

  • Gits
    February 29, 2012 - 10:09 pm | Permalink

    You don’t need executable permissions to run the file when you prefix it with perl on the command line like that.

    $ cat helloperl.pl
    print “Hello Cruel Perl\n”;
    $ ls -l helloperl.pl
    -r——–+ 1 admin staff 28 1 Mar 15:36 helloperl.pl
    $ perl helloperl.pl
    Hello Cruel Perl
    $

    You do need it if you are going to be running the file standalone, but that also means adding the first line:

    $ cat helloperl.pl
    #!/usr/bin/env perl
    print “Hello Cruel Perl\n”;
    $ chmod +x helloperl.pl
    $ ./helloperl.pl

  • Comments are closed.