In the context of Perl user-defined subroutines, which statement is the most accurate?
Consider the following lines of code:
$_ = "This is a test";
s/^([^ ]*)\s*([^ ]*)/$2 $1/;
print;
What is the output of these lines of code?
Which one of the following choices will replace all occurrences of the word perl with the word Perl?
Consider the following statement:
$buffer = a string;
Also consider that a file named test.txt contains the following line of text:
One line of test text.
What is the output of the following lines of code?
$file = "test.txt";
open (OUT, "<$file") || (die "cannot open $file: $!");
read(OUT, $buffer, 15, 4);
print $buffer;
Consider the following program code:
$Animal = Dogs bark;
package Cat;
$Animal = Cats purr;
{
package Fish;
$Animal = Fish swim;
}
package main;
print $Animal;
What is the result of executing this program code?
Consider that a file named test.txt contains this line of text:
One line of test text.
What is the output of the following lines of code?
$file = "test.txt";
open (OUT, "<$file") || (die "cannot open $file: $!");
seek(OUT, 15, 0);
read(OUT, $buffer, 5);
print $buffer . "\n";
print tell(OUT);
Which keyword indicates an object reference rather than a variable reference?
Consider the following lines of code:
$_ = "This is a test";
s/^([^ ]*)\s*([^ ]*)/$2 $1/;
print;
What is the output of these lines of code?
Consider the following program code:
$Animal = Dogs bark;
package Cat;
$Animal = Cats purr;
{
package Fish;
$Animal = Fish swim;
} p
ackage main;
print $Animal;
What is the result of executing this program code?
Consider the following lines of code:
sub mySub {
$_ = @_[1];
$a = shift;
$b = shift;
return $a * $b * $_;
}
mySub(1,2,3);
What is the output of these lines of code?
Consider the following statement:
@array1 = (9, "A", 0..9, "PERL");
Given this statement, @array1 consists of how many elements?
Which of the following choices demonstrates the correct syntax for creating a hash?
Consider the following program code:
$Animal = Dogs bark;
package Cat;
$Animal = Cats purr;
{
package Fish;
$Animal = Fish swim;
}
package main;
print $Animal;
What is the result of executing this program code?
Consider the following program code:
$x = 5;
$y = 10;
while (++$x < 10 && ++$y < 15)
{
print ($x $y );
}
print ($x $y );
What is the result of executing this program code?