Convert awk command to Perl

Hi all;

I have a Perl script that uses this awk command wrapped in a "system" call; it works exactly as I want it; however I want to keep this a Perl script and have very few if any "system" command...so the question; can someone help me code this in Perl please ... i have tried an now I am doing this :wall::wall::wall:

system( q@awk -F',' 'FNR==NR {buff[$1]=$0;next}
                  {
                     if(buff[$1]=="") { new[$1]=$0; next;}
                     if(buff[$1]==$0) { delete buff[$1]; next;}
                     if(buff[$1]!=$0) { chng[$1]=$0; delete buff[$1];}
                  }
                  END{
                     for (var in new) print new[var] > "/tmp/newrecs";
                     for (var in chng) print chng[var] > "/tmp/chngrecs";
                     for (var in buff) if(buff[var]!="") print buff[var] > "/tmp/delrecs";
                 }' /tmp/fuss_lsof_conf.txt /tmp/fuss_lsof_conf2.txt >/tmp/diff_fuss_file.txt@ );
 

Thanks
G

Try a2p (it has some issues, so you may need to adjust some parts manually).