i have a folder called 'error' and in that, i have error log
files which are generated by the build,
now i want to findout the string 'error' from each log
file and that error has to be copied into the another file
called 'analysis'.
how do you do this in perl?
Answer Posted / vipul dalwala
# Correction to my above post
$infile = 'errorlog.txt';
$outfile = 'analysys.txt';
open(INFILE,"$infile") || die "Unable to Open $infile-$!";
open(OUTFILE,">$outfile") || die "Unable to Open $outfile-
$!";
while ( <INFILE> ) {
print OUTFILE $_ if (/error/);
}
close INFILE;
close OUTFILE;
| Is This Answer Correct ? | 6 Yes | 1 No |
Post New Answer View All Answers
What does the qq{ } operator do?
There are two types of eval statements i.e. Eval expr and eval block. Explain them.
How can you use Perl warnings and what is the importance to use them?
What does redo statement do in perl?
what is the difference between java and cgi?
Explain which feature of PERL provides code reusability?
What is chomp() operator/function?
What is eval function in perl?
Differences between die and exit.
Perl regular expressions are greedy" what does this mean?
Difference between the variables in which chomp function work ?
How do you turn on the perl warnings?
Explain the meaning of subroutine?
List all the features of perl programming?
What can be done for efficient parameter passing in perl?