perlquestion pgmer6809 <p>On Rosetta (https://rosettacode.org/wiki/Continued_fraction#Perl )</p> <p>there is the perl solution to evaluating Continuous fractions. The code given is: (<===== comments added by me) </p> <code>sub continued_fraction { my (\$a, \$b, \$n) = (@_[0,1], \$_ // 100); #<========= what is \$_ // 100 ?? \$a->() + (\$n && \$b->() / continued_fraction(\$a, \$b, \$n-1)); } printf "&#8730;2 &#8776; %.9f\n", continued_fraction do { my \$n; sub { \$n++ ? 2 : 1 } }, sub { 1 }; # <===== Note there is no third arg passed printf "e &#8776; %.9f\n", continued_fraction do { my \$n; sub { \$n++ || 2 } }, do { my \$n; sub { \$n++ || 1 } }; # <===== Note there is no third arg passed printf "&#960; &#8776; %.9f\n", continued_fraction do { my \$n; sub { \$n++ ? 6 : 3 } }, do { my \$n; sub { (2*\$n++ + 1)**2 } }, 1_000; #<==== Here there is a 3rd arg printf "&#960;/2 &#8776; %.9f\n", continued_fraction do { my \$n; sub { 1/(\$n++ || 1) } }, sub { 1 }, 1_000; #<==== Here there is a 3rd arg </code> <p> The output shown on Rosetta is correct</p>. <p>My TWO questions are:</p> <p>1) Why can they pass in two arguments sometimes (two function refs) and three arguments other times (two function refs, and an integer count?</p> <p>2) What value does the expression <code>\$_ // 100</code> assign to \$n ?</p>