Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Building XML with tab delimited

by Anonymous Monk
on Aug 11, 2016 at 03:34 UTC ( [id://1169552]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1169552]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (9)
As of 2024-03-28 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found