$ catfiles.pl *.txt *.html > mynewfile.txt #### #!/usr/bin/perl use strict; use warnings; local $|=1; #turn of buffering for ( map { glob $_ } @ARGV ) { open my $FH, '<', $_ or do { warn "Can't open '$_' for read, skipping: $!"; next; } while (<$FH>) { print $_ } close $FH; }