in reply to Re^4: Perl program - I hope I can more understand my code
in thread Perl program - I hope I can more understand my code
If my memory serves me correctly, you have changed the code in the OP (without citation; please see below). The latest code I see in the OP seems very close to what I think you want; it certainly seems closer than what I see above.
If you compile the latest code in the OP you see error messages like
Global symbol "@prime" requires explicit package name at ...
Missing right curly or square bracket at ...
(The ... represent line numbers that I do not see because I am compiling from the command line. If you compile from a source file, you should see valid line numbers.) Please address these (fairly minor) errors in the latest code in the OP.
Once you correct these errors, please consider the statement
my $f = listprimes($a);
This takes the list returned from the listprimes() call and assigns it to a scalar variable. Is this correct? What would happen if this list was assigned to an array and the array was then printed? If you address this final problem, I think you're done.
Finally, if my memory serves me correctly, you have changed the code in the OP without citation! Please don't do that; it makes every reply that refers to the original Original Post inconsistent and incoherent. Please see How do I change/delete my post? for the proper etiquette for making changes to your posts. The basic commandment is this: Do Not Destroy Context.
Also: don't use $a $b for lexical variable names; they are Perl special variables (see perlvar) and have special uses.
Give a man a fish: <%-{-{-{-<
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Perl program - I hope I can more understand my code
by AppleFritter (Vicar) on Oct 22, 2015 at 23:31 UTC |