Good morning Monks, Im fairly new to Perl, I get an output file from a software which is a text file seperate by tabs(although some tabs look longer than others). I can also send an edited version of the file if someone needs the actual file to work with. Here is the code I am using to parse it:
# Opens file $file3 = "c:\\users\\plor\\desktop\\Presc_count2.txt"; $file4 = "c:\\users\\plor\\desktop\\Presc_count3.txt"; open INPUT2, ">", $file4 or die $!; open OUTPUT2, "<", $file3 or die $!; while ($t2 = <OUTPUT2>) { @lines = split /s+/, $t2; print "$lines[0],$lines[1]\n"; } } close(OUTPUT2); close(INPUT2);
When I try to print to test "$lines[0], $lines1" it doesn't give me the output I was expecting, I would've thought it would give me the first two words on that line, instead it prints out either a blank space or nothing(i cant tell if its a space or not). I also tried using split with ('\t') also and I get the same result. Basically I just want each word stored in an element of an array so I can manipulate it. Thanks in advance for any knowledge you guys can pass down to me. -Pao
In reply to Extracting from output file by AllPaoTeam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |