for ($i=0; $i < @keys; $i++) { if ($keys[$i] eq $key) {last} # 'last' exits from the for loop } if ($i < @keys) { # $key already exists in the hash $values[$i] = $value; } else { # $key is new push @keys, $key; push @values, $value; }
In reply to Re: Learning about hashes
by cmac
in thread Learning about hashes
by molson
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |