hi everyone!
i'm kind of new to perl and having some problems with a script i wrote. hope i came to the wright place :)
here's my problem:
i wrote a script that goes through each line in a file (i loaded the file into an array "RevLogFile") and when it finds a match to a string it prints the line into a new file.
#!/usr/bin/perl
use warnings;
open (MYFILE, 'RevLogFile.txt');
@RevLogFile = <MYFILE>;
open (FILE, 'ParsedLog.txt');
foreach $line (@RevLogFile) {
if ($line eq "Disk") {
open (FILE, '>>ParsedLog.txt');
print FILE $line;
}
}
the problem is, it doesnt work. running the script goes without problems, but when i check "ParsedLog.txt" i find a blank file.
i tried just printing each line to the file and it works, so the array and the 'foreach' works fine. i guess its the 'if' that's the problem.
any help appreciated! :)