MCQs > IT & Programming > Perl > What will be the output of the following Perl program? if ('5678' =~ /(?5)(?6)(?7)(?8)/) {foreach my $b_name (sort keys %-) { my $array_n = $-{$b_name}; foreach my $i (0..$#$array_n) { print '\$-{$b_name}[$i] : ', (defined($array_n->[$i]) ? ' '$array_n->[$i]' ' : 'undef'), '\n'; } } }

Perl MCQs

What will be the output of the following Perl program?

if ('5678' =~ /(?5)(?6)(?7)(?8)/)

{foreach my $b_name (sort keys %-)

{ my $array_n = $-{$b_name}; foreach my $i (0..$#$array_n)

{ print "\$-{$b_name}[$i] : ", (defined($array_n->[$i]) ? "'$array_n->[$i]'" : "undef"), "\n"; } } }

Answer

Correct Answer:

$-{X}[0] : '5'

$-{X}[1] : '7'

$-{Z}[0] : '6'

$-{Z}[1] : '8'


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