Hi all, the following structure does not work as intended:
sub read_index { my $gedicht_path = shift; my (%author_indexlines, %author_headlines, %gedicht_lines, @author_letters, @gedicht_letters, @alphabet_index); find (\&read_poem, $gedicht_path); print %author_indexlines; # nothing is printed out here! return \(%author_indexlines, %author_headlines, %gedicht_lines, @author_letters, @gedicht_letters, @alphabet_index); } sub read_poem { # scalars to read from the poem page my ($vorname, $nachname, $title, $namekey, $titlesort_string, $nameletter, $titleletter, $page, $relative_path); my $pathname = $File::Find::name; return 0 unless $pathname =~ /\.html$/; # definition of the file path relative to the $gedicht_path $relative_path = $pathname; $relative_path =~ s#$gedicht_path/##; # Perl complains about uninitialized value here [filling the hashes and arrays declared above] print %author_indexlines; # the hash is printed correctly here } I expect the variable $gedicht_path to be accessible inside the read_poem subroutine, since it is called from within read_index, it is not (I get an 'uninitialized value' error). Second, I expect the hashes and arrays in declared in read_index to be filled in read_poem. read_poem does not complain about undeclared variables, and I can print the appropriate %author_indexlines etc. from within read_poem, but not from read_index, as intended. Can anyone point me to the (probably obvious) problem with the locally scoped variables? Thanks, Jan -- Either this man is dead or my watch has stopped. - Groucho Marx -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>