# open the file open(FH,$filename) or die $!; # loop through the file till the end of it line by line while ( my $line = ) { #remove "\n" from the end of the line chomp($line); # now Extract values from line in array my @array = split(/,/,$line); #here you can do whatever you want in the valus you have , $array[0] is the first element } close(FH);