Patrick Dwyer

Echo :: Perl

in News, Perl, Comparative Programming by patrick

This program is part of the Comparative Programming :: Echo set of examples.

This example could be a one liner in Perl, but we’ve stretched it to three lines to make sure it’s well formed. Besides a directive at the top of the file pointing to the Perl interpreter, and a single module ‘use’ statement, the body of our program is a single line joining all of our input arguments (provided automatically in @ARGV) with a space as the delimeter.


use strict;

print join(’ ‘, @ARGV) . "\n";

Program Source:

Running the example

From the command line:

perl Hello World