Apparently, you are rewriting the value of the @alphaid and @betaid arrays on each of the loops after the s///.
What are you trying to do with: @alphaid = $line; push(@alphaid,$_); I'd try only: push(@alphaid, $line); if I understood correctly. Cheers, David. On Feb 11, 2008 3:11 PM, <[EMAIL PROTECTED]> wrote: > Hi, > I am learning to print two arrays in a single file but unable to > do. So, I am printing it in two files. Any ideas > > # Populating the arrays @alphaid and @betaid > foreach my $line (@File1) > { > if ($line =~ /^AC/) > { > $line =~ s/^AC\s*//; > @alphaid = $line; > push(@alphaid,$_); > } > > if ($line =~ /^DR/) > { > $line =~ s/^DR\s*//; > @betaid = $line; > push(@betaid,$_); > } > } > > #Printing the arrays in two files. Here I would like to have them in a > single with tab character separating the #arrays such as > # alphaid[1] \t betaid[1] > # alphaid[1] \t betaid[2] > # and so on > > foreach $alphaid (@alphaid) > { > open (MYFILEG, '>>f1.txt'); > print MYFILEG @alpha; > close (MYFILEG); > } > > foreach $betaid (@betaid) > { > open (MYFILEE, '>>f2.txt'); > print MYFILEE @betaid; > close (MYFILEE); > } > > any help will be appreciated. > -K > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > http://learn.perl.org/ > > > -- David Moreno - http://www.damog.net/ Yes, you can.