Explain:-
a.) Subroutine
b.) Perl one-liner
c.) Lists
d.) iValue
Detailed Explanation
a.) Subroutine
Subroutines are named blocks of code that accept arguments, perform required operation and return values. In PERL, the terms subroutine and function are used interchangeably. Syntax for defining subroutine: sub NAME or sub NAME PROTOTYPE ATTRIBUTES to be specific where prototype and attributes are optional. PROTOTYPE is the prototype of the arguments that the subroutine takes in and ATTRIBUTES are the attributes that the subroutine exhibits.
b.) Perl one-liner
One-liners are one command line only programs (may contain more than one perl statements) that are used to accomplish an operation. They are called so because the program can be typed and executed from the command line immediately.
Eg:
# run program, but with warnings
perl -w my_file
# run program under debugger
perl -d my_file
c.) Lists
Lists are special type of arrays that hold a series of values. Lists can either be explicitly generated by the user using a paranthesis and comma to separate the values or can be a value returned by a function when evaluated in list context.
d.) iValue
An ivalue is a scalar value that can be used to store the result of any expression. Ivalues appear in the left hand side of the expression and usually represents a data space in memory.
Discussion (0)
No comments yet. Be the first to share your thoughts!
Share Your Thoughts