diff options
author | Yves Orton <demerphq@gmail.com> | 2022-04-14 06:03:13 +0200 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-04-19 05:41:19 -0600 |
commit | 0acd1e305e05d95e7aa3ab40eacaa269e2c3d74c (patch) | |
tree | 5aa002bb71c63fe333334b2ec23f45ae44f60551 | |
parent | 4585b71856ed2922a89fe34dc2a9bc57bdbbdad1 (diff) | |
download | perl-0acd1e305e05d95e7aa3ab40eacaa269e2c3d74c.tar.gz |
regen/mph.pl - convert loop to use block form and add comment
Using the comma operator to separate statments is fine on a one liner,
but so much in a script that is part of perl regen processes. IMO.
-rw-r--r-- | regen/mph.pl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/regen/mph.pl b/regen/mph.pl index 577563011d..79d3ee2989 100644 --- a/regen/mph.pl +++ b/regen/mph.pl @@ -129,10 +129,16 @@ sub build_perfect_hash { } @$keys; last; } + } + # now that we are done we can go through and fill in the idx and + # seed2 as appropriate. We store idx into the hashes even though it + # is not stricly necessary as it simplifies some of the code that + # processes the \@second_level array later. + foreach my $idx (0 .. $n - 1) { + $second_level[$idx]{seed2}= $first_level[$idx] || 0; + $second_level[$idx]{idx}= $idx; } - $second_level[$_]{seed2}= $first_level[$_] || 0, $second_level[$_]{idx}= $_ - for 0 .. $#second_level; return $seed1, \@second_level; } |