You have an array of IP addresses but are only interested in the unique values. Since perl doesn't have a unique() function, we'll exploit the concept of unique keys in hashes:
#!/usr/bin/perl
my @ipAddresses = ('192.168.0.1', '192.168.0.27',
'192.168.0.1', '192.168.0.3');
print "Before: ", qq(@ipAddresses), "\n";
undef %saw;
@saw{@ipAddresses} = ();
@sorted = sort keys %saw;
print "After : ", qq(@sorted), "\n";
Resulting in:
Before: 192.168.0.1 192.168.0.27 192.168.0.1 192.168.0.3 After : 192.168.0.1 192.168.0.3 192.168.0.27
perlsortunique