in reply to To remove duplicates inside a string

This script deletes all duplicate paragraphs:

#! perl use strict; use warnings; my $string = do { $/ = undef; <DATA>; }; my @original = split /\n\n+/, $string; my @unique; OUTER: for my $orig (@original) { $orig eq $_ && next OUTER for @unique; push @unique, $orig; } print join("\n\n", @unique); __DATA__ 75160 etc.

Is that what you wanted? If not, you will need be more specific, and also show the desired output.

Hope that helps,

Update: ++hdb (when the Vote Fairy next visits) for the note on paragraph mode, below.

Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

Replies are listed 'Best First'.
Re^2: To remove duplicates inside a string
by hdb (Monsignor) on Jun 29, 2013 at 08:56 UTC

    One remark: setting $/="" (paragraph mode) avoids the two step reading of the file:

    my @original = do { $/ = ""; <DATA>; };