in reply to Re: passing variables between subroutines
in thread passing variables between subroutines

Thanks to everyone for your help. It would appear I have some reading to do. I do have one more question though. Should I just call the mailoff sub from the IP_check sub instead of from the main body of the script? Would this be better?
  • Comment on Re^2: passing variables between subroutines

Replies are listed 'Best First'.
Re^3: passing variables between subroutines
by blazar (Canon) on Jan 17, 2006 at 10:58 UTC

    They're trying to explain you that you're using subs that are actually portions of code factorized away, but you're using them to manipulate "global" variables as a side effect. Sometimes it is sensible to do so, but it's rare: most often, and I mean most, you want to exploit a distinctive feature of them, precisely the one that makes them "functions", i.e. you give something to them to eat, and they spit out a result for you.

    Different languages use different mechanisms for parameter passing. Perl uses a special array called @_: there are several idioms in connection with it. To go on, I heartily recommend you read perldoc perlsub - you wrote that you're "self taught", so please (do a favour to yourself and) continue your self-teaching on that page!