parsing a flat file and removing duplicates Have some code that I wrote to parse a flat file of IP address and other junk unwanted information. Just wanting to see if there was any way to make shorter or better. 

#!/usr/bin/perl

use strict;
use warnings;

#opening the access_log flat file that contains a list of ip addresses with unwanted information after, and contains duplicate IPs
#example, "203.151.232.51 - - DateTime Junk URL Information"
open (YYY, "/home/access_log");
#assigning flat file to an array
my @incomingarray=&lt;YYY&gt;;

my $value = 0;

#splitting up the array and assigning variables to the pairs
foreach my $pair(@incomingarray) {
  (my $ip, my $junk) = split(/ - - /, $pair);
  $incomingarray[$value] = $ip;

  #autoincrementing the scalar
  $value++;
}

close (YYY);

#print @incomingarray;

#creating a hashlist from the array and using the map function to remove duplicates
my %IPlist = map { $_ =&gt; 1 } @incomingarray;

#creating a new array by using the keys function to loop through the hash list
my @distinctIP = keys %IPlist;


foreach (@distinctIP) {
  print "$_\n";
}
You should probably close the file as soon as you are finished.
Divorcing the open() and close() makes it harder to see maintain.
Move close() to here (just after you finish using the file).
open (YYY, &quot;/home/access_log&quot;);
#assigning flat file to an array
my @incomingarray=&lt;YYY&gt;;
close (YYY);

In the main loop you add overwriten the current values with just the IP address I would not consider this good practice (though it works here because of the simplicity of the program). And since your next step is to convert the array into a hash why not do so directly in the loop.
  $incomingarray[$value] = $ip;

Why not just do:
  $IPlist{$ip} ++; // Increment the count that way you can count each IP.

There is no need to create a new array just to loop over them. You can use the keys directly in the foreach statement to loop over the hash.
my @distinctIP = keys %IPlist;
foreach (@distinctIP) {
  print &quot;$_\n&quot;;
}

Just as easy to write:
foreach (keys %IPlist) {
  print &quot;$_\n&quot;;
}

Two things no note about variables.
Using the automatic variables $_ and @_ make writing the code easier but (in my opinion) also can make the code harder to read and maintain (if overused). This is why perl has got the reputation of being a write once never read or understand again language. So please try and be explicit.
Also all the variables you declare are global scope (you seem to have fixed this). I know for this short program it does not make any difference but a habit you should get into is declaring variables with my. This scopes the variable to the current block (thus making them behave like variables in most other modern languages). By doing this you reduce problems associated with modifying global state accidentally and when you do drop my you know it is on purpose and thus affecting the global version.
Loading the whole array.
Personally I would not have loaded the file into the array and parse it. I would have just read the file line by line and done the appropriate parsing:
#!/usr/bin/perl

use strict;
use warnings;

my %IPList ;
open(YYY, &quot;access_log&quot;);
while(my $line = &lt;YYY&gt;)
{
    chomp $line;
    (my $ip, my $junk) = split(/ - - /, $line);

    $IPList{$ip}++;
}
close(YYY);