MCQs > IT & Programming > Perl > What will be the output of the following Perl program? sub myExample { my $a = shift; return sub { my $b = shift; print '$a, $b!\n'; }; } $var1 = myExample('Mango'); $var2 = myExample('Fruit'); &$var1('Potato'); &$var2('Vegetable');

Perl MCQs

What will be the output of the following Perl program?

sub myExample {

    my $a = shift;

    return sub { my $b = shift; print "$a, $b!\n"; };

}

$var1 = myExample("Mango");

$var2 = myExample("Fruit");

    &$var1("Potato");

    &$var2("Vegetable");


Answer

Correct Answer:

Mango, Potato!

Fruit, Vegetable! 


Explanation:

Note: This Question is unanswered, help us to find answer for this one

Perl Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

Perl Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it