Question : problem with external subroutine

I'm having trouble using an external "myutilities" library or subroutine (not sure which is most simple.  In essence, I am using perl in ubuntu and I have a "mymain.pl" script and I want to essentially "process" another script "load_vars.pl" which loads a bunch of variables, then later in "mymain.pl" I want to use an external subroutine in "myutilities.lib" or "myutilities.pl" (whichever is easiest).  I'm not looking for long-term code reuse or anything like that.  I'm just looking to get this project finished asap.
I'm new to perl, but I'm really leveraging all the regex capabilities.  Please give me some guidance, I've tried "use", "require" etc. and nothing works.  I'm sure this is quite easy.  A very very short example using the following is appreciated.

print "start: I am in mymain.pl \n";
...
print "loading variables...  I am in load_vars.pl now \n";
...
print "using utilities...  I am in myutilities now \n";
...
print "end: I am back in mymain.pl\n";

Thanks.
Chris

Answer : problem with external subroutine

If you don't want to use the deprecated "use vars" you can pass the variables to the sub routines in myutilities.pl, and in load_vars.pl, return them after they are assigned. In this case, you must use a sub routine in load_vars.pl
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
mymain.pl
#!/usr/bin/perl
use strict;

my ($a,$b,$c);
require 'load_vars.pl';
require 'myutilities.pl';
print "start: I am in mymain.pl\n\n";
($a,$b,$c) = &load_vars;
&myutilities($a);
print "end: I am in mymain.pl\nand n mymain the variables loaded are:\na=$a\nb=$b\nc=$c\n";

load_vars.pl
#!/usr/bin/perl
use strict;

sub load_vars {
  print "loading variables...  I am in load_vars.pl now\n\n";
  my $a = 'apple';
  my $b = 'banana';
  my $c = 'cherry';
  return ($a,$b,$c);
}
1;

myutilities.pl
#!/usr/bin/perl
use strict;

sub myutilities {
  my ($a) = @_;
  print "using utilities...  I am in myutilities now\n".
  "and in myutilities a = $a\n\n";
}
1;


Output:
[root@dm1 ~]# ./mymain.pl
start: I am in mymain.pl

loading variables...  I am in load_vars.pl now

using utilities...  I am in myutilities now
and in myutilities a = apple

end: I am in mymain.pl
and n mymain the variables loaded are:
a=apple
b=banana
c=cherry
Random Solutions  
 
programming4us programming4us