I have a subroutine which is used by 2 programs. I want to make that subroutine a module. The subroutine uses some variables which i have declared in my main program. I am not able to pass those variable to my module. The subroutine is given below: The variables $base_files_used$exp_string and $base_files_to_remove$exp_string are declared in my main function. How should i call those two variables in my module? I have the same 2 variables declared in my other program which uses different values. Any help will be greatly appreciated.
sub note_file_for_tarball {
if ( 2 != @_ ) {
die "Wrong number of arguments to note_file_for_tarball. Dying at ";
}
my $filename = $_[0];
my $to_be_removed = $_[1];
my $file_log = "$base_files_used$exp_string"; my $remove_log = "$base_files_to_remove$exp_string";
open( FILE_USE_LOG, ">> $file_log" ) || die "Could not open $file_log for writing. Died at ";
print FILE_USE_LOG "$filename\n";
close( FILE_USE_LOG ) || die "Could not close $file_log. Died at ";
if ( $to_be_removed ) {
open( FILES_TO_REMOVE, ">> $remove_log" ) || die "Could not open $remove_log for writing. Died at ";
print FILES_TO_REMOVE "$filename\n";
close( FILES_TO_REMOVE ) || die "Could not close $remove_log. Died at ";
}
}
Shilpa
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>