Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: redrafted code

by lyklev (Pilgrim)
on Feb 02, 2011 at 08:21 UTC ( [id://885680]=note: print w/replies, xml ) Need Help??


in reply to redrafted code

Move the subroutine definition to somewhere else, for example to the top of your code, before the main part of the code starts. Then call the subroutine at the point in the code where you have now defined it.

Also note that when you split a line:

  • the first token starts at index 0, so your latitude will be $tokens[4] and your longitute will be $tokens[5];
  • the last token will contain the newline at the end of the line, so before splitting, you might want to chomp the line.

Replies are listed 'Best First'.
Re^2: redrafted code
by chromatic (Archbishop) on Feb 02, 2011 at 18:12 UTC
    Move the subroutine definition to somewhere else, for example to the top of your code, before the main part of the code starts.

    Perl 5 parses the entire code before running it, so this is only relevant if your sub declaration relies on runtime effects.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-19 08:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found