Perl

Perl

Perl Q: Write the code for finding the factorial of a passed integer. Use a recursive subroutine. A: // BEGIN PERL SNIPET sub factorial { my $y = shift; if ( $y > 1 ) { return $y * &factorial( $y - 1 ); } else { return 1; } } // END PERL SNIPET Q: Given $a = "5,-3,7,0,-5,12"; Write a program to find the lowest number in the string. A: // BEGIN PERL SNIPET $a = "5,-5,-1,0,12,-3"; (@temp) = split (/,/, $a); $lowest = $temp[0]; for ($i=0; $i<6; $i+) { if ($temp[$i] < $lowest) { $lowest = $… More information...

User: Saurabh Dayal
Page: vlsiquestions.webnode.com (?)

Build your Free Website!

  • 100% free
  • In only 5 min
  • Your own domain
  • No Ads
  • No installation
  • No technical skills
Create website for free

Follow us on Facebook!

Webnode on Facebook

Webnode on Twitter:

Don't forget to enter our Valentine’s Day Contest! Pledge your love to Webnode and win an Apple iPhone S4! http://t.co/dcxM0b9C

Follow us!
Forgot your password?