in reply to Program Not Printing Help
Hello Hrand, and welcome to the Monastery!
First: always begin your script with:
use strict; use warnings;
as this will help you identify typos and other syntax errors.
Second, you cannot pass subroutine arguments in Perl as you do in C/C++. You need something like:
sub isPalindrome { my $orig = shift; my $reversed = 0; my $n = $orig; ...
Third, there is a logic error in the second for loop: the first occurrence of the line:
$temp++;
should be deleted.
There are various other observations that could be made as to style, such as preferring for my $i (0 .. $testCases - 1) to the C-style loop used, but the points above are the main ones to start with.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
|
|---|