Posts

Showing posts with the label perl

PERL program which takes input from the user

#!/usr/bin/perl print("enter the name please"); $name=<STDIN>; print("Mr $name \r\bthanks for entering your name "); When the perl interpreter sees a statement , it breaks the statement down into smaller units of information. In this example $name,=,<STDIN>,; are the smaller units of information...these smaller units of information are known as tokens. The first token $name is an example of scalar variable.in perl, a scalar variable can store one piece of information.. The = token called the assignment operator tells the perl interpreter to store the item specified by the token to #the right of the = in  the place specified by the token to the left of the = The <STDIN> represents a line of input from the standard input file...The STDIN contains everything you enter when running a program..The <STDIN> tells the perl interpreter to read one line from the standard input file. The ; token at the end of the statement is a special ...

My First perl program

My First perl program: Create a file with filename.pl #!/usr/bin/perl print "Hello World.\n"; First Line: Every program starts with this line..It is the perl interpreter and will vary from system to system ... To Know about your interpreter type in command prompt $which perl Second Line: It is used to print the Hello World on the screen.. To execute type in command prompt $perl filename.pl