The above should run on a standard perl install. As far as compiling it... you don't need to as Perl is a scripting language, all you need to do is to chmod +x your file to make it executable and then ./script.pl or run it like this (you don't need to chmod +x it in this case):Code:#!/usr/bin/perl #This is a comment that spans one line #Filename script.pl #Written by Mechdave as an example #Written on 16/5/2007 #Use strict to restrict unsafe constructs in the language, the below imports all possible restrictions! use strict; #The below line will print Hello World to the console print "Hello World\n"; #Print the question print "Hello my name is HAL, what is yours? "; #Now for user input my $user_name = <STDIN>; #Chomp removes the newline at the end of the line chomp($user_name); #Print entered name back to console print "Hello $user_name nice to meet you\n"; #Script end
[mechdave@homeunix]$ perl script.pl
There are plenty of Perl tutorials on the net I used this one to start with, also search.cpan.org is very good for info on modules. Perl.com is good too
Have fun...![]()


Reply With Quote

Bookmarks