Help for this page

Select Code to Download


  1. or download this
    my $prev;
    
    while (<>) {
        next if ($_ eq $prev);
        print $prev = $_;
    }
    
  2. or download this
    my $prev;
    
    while (<>) {
        print $prev = $_ unless $_ eq $prev;
    }
    
  3. or download this
    my $prev;
    $_ ne $prev and print $prev = $_ while <>;