> how do i go about getting a global variable to show, without putting ,
> defining it locally in the sub.
> i dont want to be defining things in subs as i have alot of global and
> private variables and alot of subs per package.

This should help to elucidate the problem you're having, run this and it
becomes pretty clear as to why you're not getting $version in there...

Run this, and see the output:

package foo;
 &command::about;
1;


package command;
 &about;
 my $version = 'test 1.1';
 &about;
 sub about {
  print "$version (c) John Doe\n";
 }
1;

C:\source\crap>perl foo.pl
 (c) John Doe
 (c) John Doe
test 1.1 (c) John Doe

Or, imagine doing this:

print $version;
my $version = "1.1\n";
print $version;

Try, in the future, using a new() method, and creating an instance of the
module (object) before attempting to use methods in it.  That way you can
initialize any variables you need before you need them.

!c

===================================
Discreet Packaging: www.dronecolony.com
C. Church
===================================


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to