hkn wrote:
> 
> Can someone please tell me how I can pass variables when using "use" ?
> 

create a file called SomePackage.pm:

package SomePackage;
our $var = "hello world.\n";
1;
__END__


and in the cgi:

#!/usr/bin/perl -w
use strict;
use SomePackage;
print $SomePackage::var;


will return

hello world.


you could also do it this way:

create a file called SQL.pm:

package SQL;
sub query {
  return <<QEND;
  select foo from bar
QEND
}
1;
__END__


and in the cgi

#!/usr/bin/perl -w
use strict;
use SQL;
print SQL->query();
exit();


this will return

select foo from bar

hope this helps.

Reply via email to