• +91 9723535972
  • info@interviewmaterial.com

Perl Interview Questions and Answers

Question - Create a function that is only available inside the scope where it is defined ?

Answer -

$pvt = Calculation(5,5);

print("Result = $pvt\n");

sub Calculation{

my ($fstVar, $secndVar) = @_;

my $square = sub{

return($_[0] ** 2);

};

return(&$square($fstVar) + &$square($secndVar));

};
Output: Result = 50

Comment(S)

Show all Coment

Leave a Comment




NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners