Fast Track Programming in Perl
In Windows give the command in the Command prompt terminal,
C:\perl -e "print \"Hello World!\n\"; " (enclosed inside double quotes)
In Linux platforms,
$perl -e 'print "Hello world\n" ' (enclosed inside both single and double quotes)
In Windows, open NotePad, type the following line:
print "Hello world\n";
save it as a file 'filename'.
Then run from command prompt as
C:\perl filename (this will execute perl commands from the file 'filename')
Save the following five lines in file and run as perl filename
#Two lines to output the local time
C:\perl -c filename (compiles but does not execute, lists the errors in the program)
C:\perl -wc filename (compiles and turns on warnings too, along with error reporting)
C:\perl -h (lists the possible options available in the installation)
To sort a set of input words from command prompt save these two lines in a file:
@sorted = sort @ARGV;
Run the program as
The words will be stored in
Thus, you can also print only selected words after sorting.
The print command is useful in generating desirable outputs. Save each of these programs in a file and run. The EOF control is a special marker to print content as prescribed.