in reply to Re^2: Removal of duplicated element in array.
in thread Removal of duplicated element in array.

Might be that you are using an older version of Perl? I'm on 5.16. Here is a two line version:

my %seen = map { $_ => 1 } split /\n/, $match; my @r = keys %seen;

Hope this now works for you. And I still assume that you want to get rid of the \n? Apologies for any confusion I caused.

Replies are listed 'Best First'.
Re^4: Removal of duplicated element in array.
by tty1x (Novice) on May 07, 2013 at 02:19 UTC
    Yup, I am using Perl v5.10.1 .

    The \n is simply for readability purposes, so if it isn't there, it is still alright.

    The output of your code outputs the same result as the input with duplicates.