Howdy AllPaoTeam, welcome to the Monastery! Athanasius already pointed out that /s+/ in your code should really be /\s+/ if you intend to split on whitespace. (That's all whitespace, BTW, not just tab characters!) And as he furthermore said, a bit of sample data that shows the problem would be good: it doesn't have to be your entire file, just a portion of it that should be handled correctly but isn't.
You can also use Text::CSV to parse such files by setting the separator to a tab character, like this:
#!/usr/bin/perl use strict; use warnings; use feature qw/say/; use Text::CSV; my $csv = Text::CSV->new({ sep_char => "\t", binary => 1, # always a good idea }); while(my $row = $csv->getline(*DATA)) { say "$row->[0],$row->[1]"; } __DATA__ word1 word2 word3 word4 word5 word6
This is going to be only useful if your words are separated by precisely one tab character, though, since otherwise you'll get empty fields in between words.
In reply to Re: Extracting from output file
by AppleFritter
in thread Extracting from output file
by AllPaoTeam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |