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 token that tells perl statement is complete..

Comments

Popular posts from this blog

bb.utils.contains yocto

make config vs oldconfig vs defconfig vs menuconfig vs savedefconfig

PR, PN and PV Variable in Yocto