I'm using a "package" type subroutine, called test_package.pl. I'm calling it from a script called split0.pl. I want to pass the $0 variable, use the subroutine to split out just the filename, and pass that filename value back to the calling script. The subroutine does the processing correctly (I've verified with print statements), but I'm having trouble getting the value passed back to the calling script.
Here's the subroutine:
-
package test_package;
-
-
sub subroutine1 {
-
@script = @_;
-
@script = split /\\/,$script[0];
-
}
-
return 1;
-
Here's the call from the calling script:
-
require 'test_package.pl';
-
#
-
# call external subroutine!
-
$full_name = $0;
-
test_package::subroutine1($full_name);
-
#
-
I'm pretty new to all this, so I'm assuming I'm overlooking something simple. I've looked at some Perl books, but haven't figured it out yet. I'd appreciate any help.