Whenever you use system, it's a good idea to test your code with "print" first, so you can make sure you're about to execute the right thing.
Also, you should use system OR ``, but not both.
Once you've decided whether you want system or `` (hint, you want system :), since you don't care about the returned text), you should fix try this:
#!/usr/bin/perl open(GG,"getall.txt"); $dest="/home/test/files/"; $targ="/home/new/newfiles/"; while ($_=<GG>){ 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);
Once you're convinced that this does the right thing, comment out the print and use the system line...
--
Mike
(Edit: Thanks, Enlil, for reminding me about chomp.)
In reply to Re: Copying files
by RMGir
in thread Copying files
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |