Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Algorithm::Diff icult to use

by tye (Sage)
on Aug 21, 2002 at 07:52 UTC ( [id://191668]=perlmeditation: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        my @a= qw( a b c   e  h j   l m n p       );
        my @b= qw(   b c d e f  j k l m     r s t );
        my @diff= easy( \@a, \@b );
    
  2. or download this
      #         @a      @b        @a       @b
      # same?  range   range    values   values
      (   0,   0=>0,   0=>-1,  #    a  !
    ...
          1,   6=>7,   7=> 8,  #  l m  =  l m
          0,   8=>9,   9=>11,  #  n p  !  r s t
      );
    
  3. or download this
        my @a= qw( a b c   e  h j   l m n p       );
        my @b= qw(   b c d e f  j k l m     r s t );
        my $diff= easy( \@a, \@b );
    ...
                print "<b>$b</b>"   if  "" ne $b;
            }
        }
    
  4. or download this
    <s>a</s>bc<b>d</b>e<s>h</s><b>f</b>j<b>k</b>lm<s>np</s><b>rst</b>
  5. or download this
        $_ .= $/   for  @a, @b;
        my $diff= easy( \@a, \@b );
        while(  @$diff  ) {
    ...
                }
            }
        }
    
  6. or download this
    -a
     b
     c
    ...
    +r
    +s
    +t
    
  7. or download this
        my $diff= easy( \@a, \@b );
        while(  @$diff  ) {
            my( $same, $aMin, $aMax, $bMin, $bMax )=
    ...
                print "> $_";
            }
        }
    
  8. or download this
    1,1d0
    < a
    3a3,3
    ...
    > r
    > s
    > t
    
  9. or download this
    sub easy
    {
        my $a= shift;      # array ref
    ...
        splice @diff, 0, 5   if  $diff[2] < 0  &&  $diff[4] < 0;
        return wantarray ? @diff : \@diff;
    }
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://191668]
Approved by jmcnamara
Front-paged by AidanLee
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-18 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found