#!/usr/bin/perl open(GG,"getall.txt"); $dest="/home/test/files/"; $targ="/home/new/newfiles/"; while ($_=){ chomp; # thanks Enlil! ($first,$second,$third)=split(/\./,$_); print "first: $first second: $second third: $third \n"; print "cp ${dest}$_ $targ\n"; #system("cp ${dest}$_ $targ"); } close(GG);