![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Mapping list to hash is dropping list itemsby eyepopslikeamosquito (Bishop) |
on Mar 13, 2022 at 11:18 UTC ( #11142067=note: print w/replies, xml ) | Need Help?? |
G'day almsdealer, Welcome to the Monastery. Given you're very new to Perl, you've made a great start! Though you're problem has already been solved (by the redoubtable haukex) I'd like to offer a couple of tips to help you on your Perl journey:
For example, with your script saved as almsdealer.pl, running: allows you to see how Perl parses your script, in your case deparse.pl contains:
Hopefully, seeing myTrim($_, 1) will set alarm bells ringing because your myTrim function takes one argument, not two. As a matter of personal style, I would write your: as: because I like to put a comment next to each parameter describing what it does, plus this style scales nicely for subroutines that take more than one argument (a random example of this style can be found here).
In Section
Seekers of Perl Wisdom
|
|