#!/usr/bin/env perl # # $Id$ # # append - append files to other files, then remove the originals use strict; use warnings; use Getopt::Std; use File::Basename; #--- command line parsing for options --# # my %opt; getopts( 'ch?', \%opt ); if ( $opt{'h'} || $opt{'?'} ) { print STDERR <> $tgt" ) or warn("cannot open output to '$tgt'\n"); open( IN, "< $src" ) or warn("cannot open input from '$src': $!\n"); select(IN); undef($/); print OUT ; close(IN) or warn("cannot close input from '$src': $!\n"); close(OUT); ( $src eq '-' ) or $opt{'c'} or unlink($src) or warn("cannot remove input file '$src': $!\n"); } } #--- go go go! ---# # my $target = pop(@ARGV) || '-'; @ARGV || ( @ARGV = ('-') ); # so there foreach my $arg (@ARGV) { &append( $arg, $target ); }