Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: redrafted code

by lyklev (Pilgrim)
on Feb 02, 2011 at 08:21 UTC ( #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
Node Status?
node history
Node Type: note [id://885680]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (4)
As of 2018-01-18 00:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (206 votes). Check out past polls.

    Notices?