Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain the execution of a program in perl.

1049


What are prefix dereferencer? List them.

1022


Explain the different types of data perl can handle.

945


How would you ensure the re-use and maximum readability of your perl code?

984


Explain use of ‘my’ keyword in perl?

978


You want to empty an array. How would you do that?

962


Explain perl. What are the advantages of programming in perl?

1093


You want to add two arrays together. How would you do that?

938


How to create a directory in perl?

1127


What are arrays in perl?

1016


If EXPR is an arbitrary expression, what is the difference between $Foo::{EXPR} and *{"Foo::".EXPR}?

1087


Explain splicing of arrays?

1000


Why aren't Perl's patterns regular expressions?

1249


Explain a tell function in perl?

1015


How are parameters passed to subroutines in perl?

996