Rather that having to rework the values you entered into your array, don't read them into an array in the first place--use a hash instead.
use strict; use warnings; use 5.010; my %pics; while (<DATA>) { chomp; $pics{$_} = 1; } my @unique_names = keys %pics; foreach (@unique_names) { say; } __DATA__ /a/b/img1.jpg /a/b/img1.jpg /a/b/img2.jpg /x/y/img2.jpg /x/y/img2.jpg /x/y/img3.jpg
--output:--
/a/b/img2.jpg /a/b/img1.jpg /x/y/img3.jpg /x/y/img2.jpg
In reply to Re: Unique entries from an array
by 7stud
in thread Unique entries from an array
by CoffeeGuy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |