Hi, I want to find out how to pass perl variables between files and functions... in C, we declare with "extern" to work in different files.... how to do in perl... between files means , i declare variable in file1 and file2 will update those variables and want to access in file1 Ex: like $var1 and $var2 in following example
between functions means, from main file i need to pass variables to function.. that function will update those arguements like $var3 and var4 in following example like in C, we pass the address of variable to functions following is the scenerio... File1 : Script1.pl --------------------- #!C:\perl\bin\perl -w require "script2.pl"; $var1 = 0; $var2 = 0; # this is a function from another file, this function #needs to update $var1 and $var2 my $ret = VAL::Validate(); print "var1 is $var1\n"; print "var2 is $var2\n"; VAL::func1($var3, $var4); print "var3 is $var3\n"; print "var4 is $var4\n"; -------------------------- File : Script2.pl ------------------ #!C:\perl\bin\perl -w package VAL; # here some code will be there sub Validate () { #update var1 and var2 variables $var1 = 50; $var2 = 40; return 0; } sub func1 { $var3 = shift; $var4 = shift; $var3 = 90; $var4 = 70; } 1; -------------- Thanx -Madhu __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]