parth00 has asked for the wisdom of the Perl Monks concerning the following question:
sub populatemessagedefs() { my ($ref_to_msg_defs,$Everythingelse) = @_; my $temp_value; my $temp_key; my @Interface_Message_List = split (',',$Everythingelse); my $i=0; foreach my $field(@Interface_Message_List) { #In next iteration $i is ‘0’ again if ($i == 0) { $temp_key = $field; $i++; #Value of $i is 1 now } elsif ($i == 1) { $temp_value = $field; if (exists $ref_to_msg_defs->{$temp_key}) { if ($field > $ref_to_msg_defs->{$temp_key}) { $ref_to_msg_defs{$temp_key} = $field; $i--; } } else { $ref_to_msg_defs{$temp_key} = $field; $i--; } } } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with variable scoping
by roboticus (Chancellor) on Mar 18, 2010 at 17:01 UTC | |
|
Re: problem with variable scoping
by almut (Canon) on Mar 18, 2010 at 17:02 UTC | |
|
Re: problem with variable scoping
by kennethk (Abbot) on Mar 18, 2010 at 17:03 UTC | |
|
Re: problem with variable scoping
by cdarke (Prior) on Mar 18, 2010 at 17:11 UTC | |
|
Re: problem with variable scoping
by biohisham (Priest) on Mar 18, 2010 at 18:11 UTC |