I think you need to add a slash here as a reference. ---> my @keys = keys(%$info);
---> my @keys = keys(\%$info); # Use a reference to a hash. Try that. Ive used references before with hashes and they work great but not like you are doing in your routine. Dan -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, May 05, 2006 8:31 AM To: [email protected] Subject: accessing referenced array from subroutine Hi, I never worked much with references to arrays or hashes, so this confuses me a bit: I fill a array from within a subroutine like this: sub Something { Win32::Lanman::NetFileEnum("\\\\audiinsa0029.in.audi.vwg", "$selecteddir", "", [EMAIL PROTECTED]) } now when I try to access the array @infos from another subroutine, I get the following error: Can't use string ("") as a HASH ref while "strict refs" in use at D:\cgi-bin\test.pl this comes from here: sub Kill_Sessions { print $cgi->header(); print $cgi->start_html('Kill Sessions'); #no strict 'refs'; foreach my $file(@files) { foreach my $info(@infos){ print Data::Dumper->Dump([$info]) if $debug; ---> my @keys = keys(%$info); #print @keys; foreach my $key(@keys) { #if ($key eq "pathname") { print "$key: ${$info}{$key}<br>"; # create array of unique filenames my $ref=${$info}{pathname}; if ($ref eq $file) { print "Hullu\n"; push(@ids, ${$info}{id}); } #} } } } print @ids; print $cgi->end_html(); } So, how could I access that array from another sub? Or am I doing something completely wrong? Lars _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
