in reply to Re: Passing variables
in thread Passing variables

You were dead on with your assumption. My setup is as follows:
#in foo.cgi my $password = 'thesecret'; require 'thefile.pl'; my $encode = encrypto($password); #in thefile.pl sub encrypto($) { # encryption algorithm ... return $Finished; }
I then get an error message that says  thefile.pl did not return a true value at foo.cgi line 10. Line 10 is the  require 'thefile.pl' line.

Replies are listed 'Best First'.
Re^3: Passing variables
by Zaxo (Archbishop) on Sep 13, 2004 at 19:11 UTC

    That error message would have simplified the answer. From perldoc -f require,

    The file must return true as the last statement to indicate successful execution of any initialization code, so it's customary to end such a file with "1;" unless you're sure it'll return true otherwise. But it's better just to put the "1;", in case you add more statements.

    After Compline,
    Zaxo

      Thanks for the reply everything works well now. Interesting usages. Perldoc = Savior. Much appreciated.