in reply to modifying the remove duplicates code

split the lines on commas into an array, then compare only the fields you're interested in:
use warnings; use strict; my @currs; my @lasts; while (<DATA>) { @currs = (split /,/)[0..2, 7..8]; my $same = 1; if (@lasts) { for (0 .. $#currs) { $same = 0 if $currs[$_] ne $lasts[$_]; } } print unless $same; @lasts = @currs; } #0 ,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 #file_name,id,user,group,permissions,links,path,date,file_size #file_name,id,user, date,file_size __DATA__ foo,123,me,us,777,golf,/home/me,5/3/11,100 foo,123,me,them,666,four,/home/you,5/3/11,100

Replies are listed 'Best First'.
Re^2: modifying the remove duplicates code
by aish (Initiate) on May 04, 2011 at 09:50 UTC
    i did get an output. how do i split it?