[prev in list] [next in list] [prev in thread] [next in thread] 

List:       perl-beginners
Subject:    Re: How to append a text file to an existing text file
From:       "John W. Krahn" <jwkrahn () shaw ! ca>
Date:       2008-09-19 15:31:26
Message-ID: 48D3C5CE.20809 () shaw ! ca
[Download RAW message or body]

Back9 wrote:
> Hello,

Hello,

> Is there a way to append a text file to an existing text file.
> For example,
> File A:
> Jan Feb Mar April ...
> 
> File B:
> 10 30 40 20 ...
> 
> After appending job, the File A would be like below.
> Jan Feb Mar April ...
> 10 30 40 20 ...

open A, '>>', 'File A' or die "Cannot open 'File A' $!";
open B, '<',  'File B' or die "Cannot open 'File B' $!";

print A while <B>;



John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic