in reply to extracting dissimilar lines

Untested:
$/ = ""; while (<>) { my ($l1, $l2) = split /\n/; $l1 =~ /=/p; my $a1 = ${^POSTMATCH}; $l2 =~ /=/p; my $a2 = ${^POSTMATCH}; next if $a1 eq $a2; print; }

Replies are listed 'Best First'.
Re^2: extracting dissimilar lines
by CountZero (Bishop) on Mar 26, 2012 at 20:04 UTC
    A bit shorter, using no split, no additional variables and only one regex:
    $/ = ""; while (<>) { /=\s*([^\n]+).*=\s*([^\n]+)/s; print unless $1 eq $2; }

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

    My blog: Imperial Deltronics
      That would fail if the second line contains more than one '='. But, if you think there's value in replacing trivial regexes (which can be dealt with by the optimizer) with complicated ones, why not:
      $/ = ""; /=(\N+)\n[^=]+=\1\n/ or print while <>;
      Or, as a one-liner:
      perl -00ne'/=(\N+)\n[^=]+=\1\n/ or print' data-file
        Even better!

        CountZero

        A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

        My blog: Imperial Deltronics