in reply to Append new files only.

if (grep { -f $_ and $_ eq $FilePath } @DirsArray){} else{

Is usually written as:

unless ( grep { -f $_ and $_ eq $FilePath } @DirsArray ) {


printf("\n" . $FilePath . "\n");

Is better written as:

print "\n" . $FilePath . "\n";


while ( $line = <FILE> ) { push(@outLines, $line); #to be sent to appended large file }

No need for a loop there, you could just do:

push @outLines, <FILE>; #to be sent to appended large file

Replies are listed 'Best First'.
Re^2: Append new files only.
by c4jjm (Initiate) on Nov 10, 2011 at 18:03 UTC

    jwkrahn, Thanks for the suggestions.

    The if statement actually does stuff for both cases, I just put the relevant portion up, but I did try removing the loop, turns out the loop is faster than the straight push, I tried 9 files (~165k lines total):

    push @outLines, <FILE>; Completed in ~0.9 seconds

    And with the while loop it completed in ~0.4 seconds.