note
japhy
Re: your "XXX" block, I've refactored the code thus:
<c>
# 0 --> identical element
if ( $which_list == 0 ) {
die "Can't happen" if @indices1 != @indices2;
foreach my $i ( 0 .. $#indices1 ) {
my ( $item1, @offsets ) = @{ $list1_aref->[ $indices1[$i] ] };
my ( $item2, $offset ) = @{ $list2_aref->[ $indices2[$i] ] };
die unless $item1 eq $item2;
push @offsets, $offset;
push @merged, [ $item1, @offsets ];
}
}
# 1 --> list 1 has an element here
if ( $which_list & 1 ) {
foreach ( @{ $list1_aref }[ @indices1 ] ) {
my ( $item1, @offsets ) = @{ $_ };
push @offsets, undef;
push @merged, [ $item1, @offsets ];
}
}
# 2 --> list 2 has an element here
if ( $which_list & 2 ) {
foreach ( @{ $list2_aref }[ @indices2 ] ) {
my ( $item2, $offset ) = @{ $_ };
my @offsets = map { undef() } 1 .. $offset_width;
push @offsets, $offset;
push @merged, [ $item2, @offsets ];
}
}
</c>
I've scrapped the 'elsifs' and used & instead of ==.
<!-- Node text goes above. Div tags should contain sig only -->
<div class="pmsig"><div class="pmsig-1936">
<hr/>
Jeff <tt><font color="#0000ff">[japhy]</font></tt> Pinyan,
[id://371157|P.L., P.M., P.O.D, X.S.]:
<a href="http://japhy.perlmonk.org/modules/">Perl</a>,
<a href="http://japhy.perlmonk.org/modules/Regexp-Parser/">regex</a>,
and <a href="http://lists.perl.org/showlist.cgi?name=perl5-porters"><tt>perl</tt></a>
<a href="http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=hacker">hacker</a>
<br>
<i>How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ <b>Meister Eckhart</b></i>
</div></div>
593215
593275