parsing script help please

2012-05-31 Thread nathalie
Hi I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2

Re: parsing script help please

2012-05-31 Thread Rob Coops
On Thu, May 31, 2012 at 11:37 AM, nathalie n...@sanger.ac.uk wrote: Hi I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1

Re: parsing script help please

2012-05-31 Thread John W. Krahn
nathalie wrote: Hi Hello, I have this format of file: (see attached example) 1 3206102-3207048 3411782-3411981 3660632-3661428 2 4481796-4482748 4483180-4483486 and I would like to change it to this 1 3206102-3207048 1 3411782-3411981 1 3660632-3661428 2 4481796-4482748 2 4483180-4483486

Re: parsing script help please

2012-05-31 Thread nathalie
thanks a lot Rob I would like an output without the $VAR... so I did add this after the push function and it is perfect, thanks a lot again foreach my $number(@othernumbers){print $rownum,\t,$elet, \n;} #!/usr/local/bin/perl use strict; use warnings; my $fh; my %results; open ( $fh,

Re: parsing script help please

2012-05-31 Thread nathalie
You want something like this: #!/software/bin/perl use warnings; use strict; my $file = example.txt; open my $in, '', $file or die Cannot open '$file' because: $!; while ( $in ) { next if /^#/; chomp; my ( $key, @fields ) = split /\t/; print map $key\t$_\n, @fields; }