Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Strange error in GD::Graph::Map

by Callum (Chaplain)
on May 07, 2004 at 14:15 UTC ( [id://351463]=note: print w/replies, xml ) Need Help??


in reply to Strange error in GD::Graph::Map

You're calling a sub before it's defined.

For example, doing::

#!/tools/bin/perl -w greet('world'); sub greet ($) { print "Hello $_[0]!\n"; }
gives:
main::greet() called too early to check prototype at .//cte line 2. Hello world!

Replies are listed 'Best First'.
Re: Re: Strange error in GD::Graph::Map
by liu (Initiate) on May 10, 2004 at 15:57 UTC
    thanks you very much for your reply, for a normal use, ususally the code for subroutine is at the last of script?
      You can put the subroutine definition just about anywhere. But if you're going to declare prototypes, that must happen before your first call to the sub.

      Just don't use prototypes. You really don't need them, really.


      Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2024-04-25 08:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found