in reply to Re: printing complex data structures
in thread printing complex data structures
you do not need to pre-declare your subroutines like you do in C for instance.
Nitpick: You do in the case of the OP's code, because otherwise Perl will complain "main::base_code() called too early to check prototype" and the code won't work (because Perl doesn't know to take a reference to %codes as the argument). In general, if a sub has a prototype, Perl needs to see its declaration before it is called. But of course I agree with the advice to not use a prototype in the first place, in which case the issue becomes moot :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: printing complex data structures
by stevieb (Canon) on Jul 24, 2017 at 15:38 UTC |