dPerl has asked for the wisdom of the Perl Monks concerning the following question:
Basically just feeding in two string array references, but the @new->shift, shift is what I do not understand. At first I thought it is equivalent to shift(@new).shift(@new) but it is not. @old->shift seems similar to shift(@old) but looking at it closer, it yields different results as well... Thank you for any wisdom you can share!my @old = split(/\s+/, $old); my @new = split(/\s+/, $new); traverse_sequences(\@old, \@new, { MATCH => sub { print OUTPUT shift(@old)."\n"}, DISCARD_A => sub { print OUTPUT "<strong><font color=red>".@old +->[shift]."</font></strong>\n"}, DISCARD_B => sub { print "<strong><font color=blue>".@new->[sh +ift, shift]."</font></strong>\n"}, } );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Traverse Sequences in Algorithm::Diff module
by believer (Sexton) on Apr 21, 2011 at 14:43 UTC | |
|
Re: Traverse Sequences in Algorithm::Diff module
by InfiniteSilence (Curate) on Apr 21, 2011 at 14:38 UTC | |
|
Re: Traverse Sequences in Algorithm::Diff module
by Khen1950fx (Canon) on Apr 21, 2011 at 16:18 UTC | |
by dPerl (Initiate) on Apr 21, 2011 at 23:12 UTC | |
|
Re: Traverse Sequences in Algorithm::Diff module
by tye (Sage) on Apr 21, 2011 at 20:10 UTC |