1. If required install perl?
sudo apt-get install perl
This should not be required in backtrack.
2. Open gedit and copy in the below
# A simple perl program to print the user input
print (“Hello, world\n”);
3. Save as PerlProgram.pl
4. Open terminal and change directory to find PerlProgram.pl
chmod +x PerlProgram.pl
In backtrack looks like bellow
root@bt:~# chmod +x PerlProgram.pl (press enter)
5. To run the program ./PerlProgram.pl (press enter)
meaning behind each line!
# Says this line is a comment and there are no executable instructions on this line
! Says this is a perl script
usr/bin/perl give the location of the perl interpreter, many programing books mention the location as usr/local/bin/perl, but this is not correct in ubuntu. In ubuntu Perl interpreter is located at usr/bin/perl.
print “Hello, type in something\n”;
This line just prompts to user to type something, similar to printf statement in C.
The chmod command (abbreviated from change mode) is a Unix command that lets a user tell the system how much (or little) access it should permit to a file
chmod +x = execute execute a file or recurse a directory tree