On Mon, May 7, 2012 at 7:52 PM, Shawn H Corey <shawnhco...@gmail.com> wrote:
> On 12-05-07 03:36 AM, lina wrote:
>>
>> How can I insert the first file into the middle of the second file,
>
>
> What code have you tried so far and please provide the expected output for
> your example.
>

I can only write some preamble, here it what I came so far,

#!/usr/bin/env perl

use strict;
use warnings;
use autodie qw(open close);
use 5.012;

open my $fh1, '<', "file1";
open my $fh2, '<', "file2";

my @parts1;

my @parts2;


while(<$fh2>){
        @parts2 =  split /\s+/, $_;
}

foreach(@parts2){
        #print $_;
}

while(<$fh1>){
        #print $_;
        @parts1 = split //,$_;
}

print $parts1[0];




$ more file1
3
2
1

$ more file2
1  2
3  4
5  6

******OUTPUT***********

1       3       2
3       2       4
5       1       6

Thanks,

>
> --
> Just my 0.00000002 million dollars worth,
>  Shawn
>
> Programming is as much about organization and communication
> as it is about coding.
>
> [updated for today's programming]
> "Show me your code and conceal your interfaces, and I shall continue
> to be mystified. Show me your interfaces, and I won't usually need
> your code; it'll be obvious."
>        -- Fred Brooks
>
> CPAN http://www.cpan.org/
> The world's largest repository of software;
> all of it tested; all of it free.
>
> --
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>

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


Reply via email to