#!/usr/local/bin/perl -w ###################################################################### # # cat.pl # Tom Kelliher # # Synopsis: # cat.pl file [file ...] # # Read files sequentially, writing them to the standard output. A # diagnostic is printed to STDERR for files not found, then processing # continues with the next file. # ###################################################################### use strict; ###################################################################### # # main() # ###################################################################### { my $file; # current file name my $i; # index variable my $line; # current line from current file # process each command line file for ($i = 0; $i <= $#ARGV; ++$i) { # try to open the file. If we can't, move on. if (!open(INFILE, $ARGV[$i])) { print(STDERR "$0: can't open $ARGV[$i].\n"); next; } $line = ; # read lines from the file while ($line) { print $line; $line = ; } close(INFILE); } exit 0; }