Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Answer: How do I join two files?

by Mago (Parson)
on Dec 14, 2004 at 10:31 UTC ( [id://414662]=note: print w/replies, xml ) Need Help??


in reply to Re: How do I join two files side by side?
in thread How do I join two files side by side?


Copy and Paste Error !

Correct Code:

#!/usr/bin/perl -w use strict; my ($string1, $string2); $/ = undef; open (FILE1, "< x") || die "Cannot open file : $!"; open (FILE2, "< y") || die "Cannot open file : $!"; open (FILE3, "> z") || die "Cannot open file : $!"; $string1 = <FILE1>; $string2 = <FILE2>; print FILE3 join('', $string1, $string2); close (FILE1); close (FILE2); close (FILE3);

Replies are listed 'Best First'.
Re^2: Answer: How do I join two files?
by ysth (Canon) on Dec 14, 2004 at 10:48 UTC
    Updated your answer; does it look ok now? Please /msg QandAEditors if you need changes made.
      How do I change my answer ?

      QandAEditors Request !

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://414662]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2024-04-26 00:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found