combining 2 files into one according to the list

hi, i have a list of file:
KB0002 KB215027
KB0003 KB215027
KB0004 KB215027
KB0005 KB204320
KB0006 KB207074
KB0007 KB215204
KB0008 KB223809
KB0009 KB236640
KB0010 KB244506
KB0011 KB205382
KB0012 KB212813
KB0013 KB236314
KB0014 KB230897
KB0015 KB232532
KB0016 KB231543
KB0017 KB214428
KB0018 KB244695
KB0019 KB207217
where 1st filename corresponds to the other one
All I need is a script that merge two files into one according to my list
Any ideas?
Thx in advance

#!/bin/bash
while read first last;do echo "cat $last >> $first && rm $last";done < list

how can i write it in perl?

---------- Post updated at 03:07 PM ---------- Previous update was at 01:56 PM ----------

ok, found out :slight_smile: