my %file_system = ( '/path/subpath1/'=>['file1', 'file2', 'file3'], '/path/=>['fil01', 'fil02', 'fil03', 'fil04', 'fil05'], '/'=>['f001', 'f002'] ); my $cpath = ''; my @folders = sort keys %file_system; for my $folder (@folders){ print "$file_system{$folder}\n"; #Everythng is ok. Prints an array refernce, such as: ARRAY(0x3381e118) print join(';', @{$file_system{$folder}}), "\n"; #Everythng is ok. Prints an array } my $listFolders = $win->BrowseEntry( -label=>'Folder:', -choices=>[@folders], #Also tried \@folders, and also, omitting -choices parameter, used $listFolders->insert('end', @folders) -variable=>\$cpath, -browsecmd=>\&listFiles(); )->pack( -side=>'top', -anchor=>'nw', -fill=>'x', -expand=>1 ); #Testing $cpath, after selection: print "$file_system{$cpath}\n"; #Sometimes prints an array refernce, such as: ARRAY(0x3381e118), sometimes not, even, though, visually, the $cpath looks the same as the according path in the %fule_system var print join(';', @{$file_system{$folder}}), "\n"; #Sometime prints an array, sometimes an array is NULL. #If I iterate keys %file_system, I see the path, that's in $cpath var, but for some reason, it doesn't match. #Testing $cpath inside the function called from the Tk widget: sub listFiles{ print "$file_system{$cpath}\n"; #Sometimes prints an array refernce, such as: ARRAY(0x3381e118), sometimes not, even, though, visually, the $cpath looks the same as the according path in the %fule_system var print join(';', @{$file_system{$folder}}), "\n"; #Sometime prints an array, sometimes an array is NULL. }