#!/usr/local/bin/perl use strict; use vars qw( $addthis $tothis $newrecord ); open (TEXT, "general.txt") || die "Couldn't open file: $|\n"; $addthis = ; close (TEXT); undef $/; open (FILES,"files.txt") || die "Could not open file: $! \n"; while ( ) { open ( DATA, $_ ) || die "Could not open file: $|\n"; $tothis = ; close (DATA); $newrecord = $addthis . $tothis; open ( DATA, "> $_" ) || die "Could not write to file: $|\n"; print $_, "\n"; print DATA $newrecord; close (DATA); } close (FILES);