On Sat, 30 Dec 2000, Bullock, Howard A. wrote:

> Sorry. I forgot to say that the input file was comma delimited data:
>  
> a,b,c,d,e
> f,g,h,i,j
>  
> Change the split or change <INFILE> to an Array for input to the join.
>  
> Does this satisfy your need? If your input is large, you may what to process
> the input in a "while" loop.
>  
> Script:
> open (INFILE, "<junk.txt");
> open (OUTFILE, ">junkout.txt");
> {
>  local $/;
>  print OUTFILE join "\t", split /,/, <INFILE>;
> }
> close INFILE;
> close OUTFILE;
> 
> -----Original Message-----
> From: Curtis, Brad [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, December 27, 2000 12:36 PM
> To: [EMAIL PROTECTED]
> Subject: trying to write out an array in tab delimination
> 
> 
> I am trying to write my array out in tab delimination 
>   
> any suggstions 
>   
> use text::ParseWords; 
> open (test, "c:/brad.txt") || die "could not open";
> open (out, ">c:/out.txt") || die "could not open out";
> while (<test>)
> {  
>  
>  @fields = split (/\t/,<test>);
>  
>  $line = @fields[25];
>  @fields[25] =~ tr/\n/-/cs;
>  write @fields out; 
>   
>   
>   
> }
> close (test);
> close (out); 
>   

One problem with you logic is that the item 'e' (along with what ever
folows it in the data file) will be concatenated with the item 'f' and
be considered as one item to be be tab separated. The OUTFILE file will
only contain 8 tabs separating 9 items. The fifth item will contain
a linefeed. 

**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to