Perl identifiers that hold a single value (number or string) should begin with a
Suppose a Perl program is started from the bash command line on a Linux system as below.
./p1.pl A B C D
Which of the following variables contains "A"?
What is the difference between eq and =~i in Perl?
| 1) | eq looks for equality and =~ means pattern matching | |
| 2) | =~ looks for equality and eq means pattern matching | |
| 3) | Both operators are equivalent | |
| 4) | There is no eq operator in Perl | |
Perl supports matching against regular expressions.
Which of the following functions can be used to divide a string into individual tokens in Perl?
Consider the following Perl code fragment for the next two questions.
$line = "128.78.12.9";
($p1, $p2) = split('\.', $line);
What does the variable $p1 contain after the code fragment completes execution?
What does the variable $p2 contain after the code fragment completes execution?
Perl statements must be terminated by
The Perl statement
open(FILE, $line):
| 1) | opens a file for appending | |
| 2) | opens a file for writing | |
| 3) | opens a file for reading | |
| 4) | opens a file for reading and writing | |
A while loop in Perl
| 1) | always executes a fixed number of times | |
| 2) | continues to iterate while the condition specified in the while statement remains false. | |
| 3) | continues to iterate while the condition specified in the while statement remains true. | |
| 4) | continues to iterate while there is a line in some file to read. | |