more useful options | |
PerlMonks |
Re: Undefined subroutine &main::by davido (Cardinal) |
on Aug 24, 2015 at 04:05 UTC ( [id://1139624]=note: print w/replies, xml ) | Need Help?? |
You never declare and define getvalue1. This:
...should be this...
And your print statement probably would be better with a newline appended to the end:
Another note: Though you are using lexical variables (my variables), you aren't using them effectively. One place where your use of lexicals could be improved upon is in how you pass values into subroutines. Instead of absorbing $email and $token into getvalue1(), pass values in:
...and invoke the subroutine like this:
In a small script like this it's not a big win, but in larger scripts (more than, say 100 lines), it becomes untenable trying to follow how a global variable's state gets manipulated throughout the course of the script. By keeping variable scopes small, and decoupling subroutines from the environment around them, you minimize action at a distance, and make it much easier to comprehend the program's logic, flow, and state. Dave
In Section
Seekers of Perl Wisdom
|
|