Hi GURUS,

I'm trying to created a hash of array inside a thread, but the hash
loses all its keys/values when leaving the function. Is there a bug in
using a hash inside a thread? Any ideas?

foreach my $i ( 1..3){

push (@BUILD_THREADS, threads->create(\&COPY, $i));

}

foreach my $THREAD (@BUILD_THREADS)

{

my @DATA = $THREAD->join();

}

sub COPY

{

my ($i) = @_;

copy ( ${SOURCE}, "${DESTINATION}_${i}");

push @{$STORE_BUILD_RESULTS{"flintstones"}}, "${DESTINATION}_${i}";

while ( my ($KEY, $VALUE) = each (%STORE_BUILD_RESULTS))

{

print "KEY, VALUE is $KEY, @$VALUE\n";   #I get correct print out.

# $COMPLETED_BUILDS = STORE_BUILD_RESULTS

}

}

while ( my ($KEY, $VALUE) = each (%STORE_BUILD_RESULTS)) #The hash is
empty. Nothing gets printed out.

{

print "KEY, VALUE is $KEY, $VALUE\n";

# $COMPLETED_BUILDS = STORE_BUILD_RESULTS

}





     - - - - -                              Cisco                            - 
- - - -
This e-mail and any attachments may contain information which is confidential,
proprietary, privileged or otherwise protected by law. The information is solely
intended for the named addressee (or a person responsible for delivering it to
the addressee). If you are not the intended recipient of this message, you are
not authorized to read, print, retain, copy or disseminate this message or any
part of it. If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.

Reply via email to