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));
 
};

All perl Questions

Ask your interview questions on perl

Write Your comment or Questions if you want the answers on perl from perl Experts
Name* :
Email Id* :
Mob no* :
Question
Or
Comment* :
 





Disclimer: PCDS.CO.IN not responsible for any content, information, data or any feature of website. If you are using this website then its your own responsibility to understand the content of the website

--------- Tutorials ---