@files = ; foreach $file (@files) { print $file . "\n"; if ( $file =~ /*\.txt/) { #add to table #copy file }