Basic Rules and Syntax
Variables, Arrays and Hashes
Hello World
Hello World
Now let us move to the real part - the programming part. Ready for the "Hello World" program?
#!/usr/local/bin/perl
print "Hello World";
Type this out in a text editor like notepad and save this to a file called 'hello.pl'. If you are using Linux/Unix, run the command 'perl hello.pl'. If you are using Windows and you have installed ActivePerl, just double click the file and the script will be executed by the interpreter.
OK. Lets see what the program does line by line. Most of the things I have already said in the Basics section.
Line 1 : #!/usr/local/bin/perl
This line tells the system where the perl interpreter is located. But this could be different in different systems. See where your perl interpreter is located by running the 'type perl' or 'which perl' command. This is not necessary in windows. But if you plan to make a CGI script, this line is a must if it is hosted on a Unix based server. And make sure that the first line is pointed to the correct location.
Line 2 : print "Hello World";
If you don't know what this line means, bang your head on the keyboard three times. If you do know what this line means, I will reinforce your knowledge by telling you what it does. This will Print the string "Hello World". Notice the semi-colon(;) at the end of the line? Let me tell you the rule number one of Perl : Always put the semi-colon at the end of the line. If you don't, the perl interpreter will punish you with a very strongly worded error message.
$var = <STDIN>;This statement will get data from "Standard Input"(Keyboard) and store the data in a variable called '$var'. Please note that the STDIN must be in capital letters.
Great! Now you are a perl programmer. But you are not a CGI Joe yet. Don't know what a CGI Joe is? A CGI Joe is a hard-core CGI script programmer with all the social skills and charisma of a plastic action figure.

Comments
sleepfunction. But I think a better way is to got to folder holding the script using a DOS terminal and executing the commandperl SCRIPT_NAME#!/usr/bin/perl
print("Enter a no");
$a=<STDIN>;
please help
--
Thank You
#!/usr/bin/perl
print("Enter a no ");
chomp ($a = <STDIN>);
print($a);
<STDIN>
-------------------
the above will print "Enter a no " you put in a number, get rid of the extra newline(what's produced whne you press ENTER)
it will print the variable contents to the screen.
After that it will wait for you to press something again (the second <STDIN>) before it actually closes.
a, strong, em, b, i, code, pre, pandbrallowed. Other tags will be shown as code(< will become <). Urls, Line breaks will be auto-formated.