<?xml version="1.0" encoding="windows-1252"?>
<node id="1012961" title="Re: Join files using perl" created="2013-01-11 14:23:48" updated="2013-01-11 14:23:48">
<type id="11">
note</type>
<author id="72516">
blue_cowdawg</author>
<data>
<field name="doctext">
&lt;ul&gt;&lt;ul&gt;&lt;i&gt;
Could somebody help me do this on a faster way? Thanks!
&lt;/i&gt;&lt;/ul&gt;&lt;/ul&gt;
&lt;p&gt;
Faster? &lt;shrug!&gt; dunno, but pull up a chair.  Here are the two input files..
&lt;code&gt;
$ cat file1.txt 
1
2
3
4
5

$ cat file2.txt 
5
4
3
2
1

&lt;/code&gt;
and here's some code:
&lt;code&gt;
#!/usr/bin/perl -w 
use strict;
use Tie::File;

my ($file1,$file2,$fileout)  = @ARGV;

tie my @ry1,"Tie::File",$file1 or die "$file1:$!";
tie my @ry2,"Tie::File",$file2 or die "$file2:$!";
tie my @out,"Tie::File",$fileout or die "$fileout:$!";

@out=(@ry1,@ry2);

untie @out;
untie @ry2;
untie @ry1;

&lt;/code&gt;
which gives you this as an output:
&lt;code&gt;
$ cat out.txt 
1
2
3
4
5
5
4
3
2
1
&lt;/code&gt;
&lt;/p&gt;
&lt;div class="pmsig"&gt;&lt;div class="pmsig-72516"&gt;
&lt;hr&gt;
&lt;font size="-2"&gt;

Peter L. Berghold  -- Unix Professional&lt;br&gt;
Peter -at- Berghold -dot- Net; AOL IM redcowdawg Yahoo IM: blue_cowdawg&lt;br&gt;
&lt;/font&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1012948</field>
<field name="parent_node">
1012948</field>
</data>
</node>
