in reply to shared variables

Here is what I think you should do.

In testlib.pl, write:

$| = 1; sub test{ $var = "Lord only knows if this will work..."; } 1;

In your main program, write.

require 'testlib.pl'; $| = 1; print "Content-type: text/html\n\n"; test(); print "$var"; exit;