Below is a subroutine that is part of a perl/Tk script. The variable
$test_path is initialized earlier to the empty string and the variable
$tests_directory is likewise initialized to the correct directory. The
array @test_files contains entries such as (test1, test2, ..) and is
correctly set by the subroutine. The problem comes with -command=>sub
{$test_path="$tests_directory/$_"; print "$test_path\n";} $test_path is
not set to $test_directory/test1, $test_directory/test2, but only to
$test_directory, as if @test_files were empty, which is not the case.
Thanks for any advice,
Dick Fell
sub tests_menu
{
opendir TESTS_DIR, $tests_directory or die " cannot open Tests
directory: $!";
my @test_files = grep {-f "$tests_directory/$_"} readdir
TESTS_DIR;
[map {[ 'command', $_,-command=>sub {$test_path="$tests_directory/$_";
print "$test_path\n";}]} @test_files];
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]