in reply to Building XML with tab delimited

Get rid of prototypes, instead of sub name() { ... write sub name { ... and report what happens

Replies are listed 'Best First'.
Re^2: Building XML with tab delimited
by sannag (Sexton) on Aug 11, 2016 at 04:23 UTC
    Well, tried it but made no difference :(

      What AnonyMonk is getting at is that you define  sub buildXMLElements() { ... } to take no arguments and then pass it a bunch of arguments. This only works because you call the function in a way that defeats prototype checking. If you had enabled warnings, Perl would have chided you about this situation:

      c:\@Work\Perl\monks>perl -le "use warnings; use strict; ;; func('hi there'); ;; sub func () { print @_; } " main::func() called too early to check prototype at -e line 1. hi there

      Prototypes can be very useful for what they're useful for. But why use them in a way that defeats their purpose and also means you have to disable warnings so it won't nag you endlessly? Please see Prototypes in perlsub, and also the very enlightening Far More than Everything You've Ever Wanted to Know about Prototypes in Perl -- by Tom Christiansen.


      Give a man a fish:  <%-{-{-{-<

        Thank you for that great explanation....I will get rid of the () where not needed.