Re: merging the columns

2008-01-24 Thread Onur Sirin
Thank you so much Jeff, It works! Best regards, Onur Jeff Pang wrote: -Original Message- From: Onur Sirin <[EMAIL PROTECTED]> i get the following error: Use of uninitialized value in scalar chomp at xxx.pl line 12. Use of uninitialized value in concatenation (.) or string at xxx.pl

Re: merging the columns

2008-01-24 Thread Jeff Pang
-Original Message- >From: Onur Sirin <[EMAIL PROTECTED]> >i get the following error: >Use of uninitialized value in scalar chomp at xxx.pl line 12. >Use of uninitialized value in concatenation (.) or string at xxx.pl line 12. Please try this: $ cat 1.txt aaa bbb xxx $ cat 2.txt ccc ddd

Re: merging the columns

2008-01-24 Thread Onur Sirin
Jeff Pang wrote: -Original Message- From: Onur Sirin <[EMAIL PROTECTED]> Sent: Jan 24, 2008 10:50 PM To: Jeff Pang <[EMAIL PROTECTED]> Cc: beginners@perl.org Subject: Re: merging the columns What if is there another file (fh3) to merge with fh1 and fh2? How s

Re: merging the columns

2008-01-24 Thread Jeff Pang
-Original Message- >From: Onur Sirin <[EMAIL PROTECTED]> >Sent: Jan 24, 2008 10:50 PM >To: Jeff Pang <[EMAIL PROTECTED]> >Cc: beginners@perl.org >Subject: Re: merging the columns > >What if is there another file (fh3) to merge with fh1 and fh2? >How s

Re: merging the columns

2008-01-24 Thread Onur Sirin
Oh that's great, thank you What if is there another file (fh3) to merge with fh1 and fh2? How should i fix that line: my @out = map { chomp; $_ . ' ' . <$fh2> } <$fh1>; regards, Jeff Pang wrote: One solution,see the code and result below: $ cat 1.txt aaa bbb xxx $ cat 2.txt ccc ddd yy

Re: merging the columns

2008-01-24 Thread Jeff Pang
One solution,see the code and result below: $ cat 1.txt aaa bbb xxx $ cat 2.txt ccc ddd yyy $ cat t1.pl use strict; use warnings; open my $fh1,'1.txt' or die $!; open my $fh2,'2.txt' or die $!; my @out = map { chomp; $_ . ' ' . <$fh2> } <$fh1>; close $fh1; close $fh2; print @out; $ perl