Dear Guru, The simple example below is by the process of "appending" the elem of @tojoin and %line. My code below attempt to update the hash recursively. Keep processing it until string "AYW".
The appending process is for simple illustration. Actually there is other more process to it. But my main aim is to "update the hash recursively" But how come my code below doesn't give the intended result as below? How can I go about it? __BEGIN__ #!/usr/bin/perl -w use strict; use Data::Dumper; my %line = ('A' =>1, 'B' =>1, 'C' =>1); my @tojoin = qw (W X Y Z); foreach my $line ( keys %line ) { print "$line\n"; foreach my $tojoin ( @tojoin ) { my $nstr = $line.$tojoin; $line{$nstr} = 1; } last if ($line eq 'AYW'); } print Dumper \%line; __END__ Intended final result from print Dumper is: $VAR = { 'A' => 1, 'B' => 1, 'C' => 1, 'AW' => 1, 'AX' => 1, 'AY' => 1, 'AZ' => 1, 'BW' => 1, 'BX' => 1, 'BY' => 1, 'BZ' => 1, 'CW' => 1, 'CX' => 1, 'CY' => 1, 'CZ' => 1, 'AWW' => 1, 'AWX' => 1, 'AWY' => 1, 'AWZ' => 1, 'AXW' => 1, 'AXX' => 1, 'AXY' => 1, 'AXZ' => 1, 'AYW' => 1, }; Intended result from: print "$line\n"; is A B C AW .... until AYW Thanks so much for your time. Hope to hear from you again. Regards, Edward WIJAYA SINGAPORE -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>