Yes you are correct, my mistake
By the way, thanks for the code!
It works great, here is the complete version that reads from and writes to files.use strict; use warnings; print "\n Running script for Jiggs \n"; my $infile = "foot.txt"; open my $in, "<", $infile or die $!; open my $out, ">", "foot1.txt" or die $!; my $line; while ( <$in> ) { chomp; s/length=//; s/xy=//g; s/region=//g; s/run=//g; tr/ /,/s; if ( /^>/ ) { print $out "$line\n" if $line; $line = $_; } else { $line .= $_; } } print $out "$line\n"; close $in; close $out; print "\n Done!\n";
Many thanks to all the responses, I learned so much today: Using RegEx's and substitution, file handling, split function, and joining arrays!
In reply to Re^2: Perl script help to convert .txt file to .csv
by Seabass
in thread Perl script help to convert .txt file to .csv
by Seabass
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |