in reply to Re: Best way to pass variables?
in thread Best way to pass variables?
I was just wanting to know if there was a better way that was used or could be used. I usualy just declare all my global variables together first. my($response, $var2, $var3, $var4); etc....
So it would usually look like such in one of my scripts:
#!/usr/bin/perl -w use strict; my($response); die "Required argument missing!\n" unless ($ARGV[0]); if ($ARGV[0] =~ /Hello/i) { $response = "Hello to you.\n"; }else{ $response = "Huh?\n"; } print $response;
This interest was sparked because in other language I code in I usually try to "limit the scope" of my variables and try not to use global variables too much. In some languages this is looked down upon and can cause problems.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Best way to pass variables?
by Roy Johnson (Monsignor) on Mar 05, 2004 at 22:31 UTC | |
|
Re: Re: Re: Best way to pass variables?
by Prior Nacre V (Hermit) on Mar 06, 2004 at 18:57 UTC |