Ok I took your code and your "log" file and did some testing on my linux box.
this small snippet of code seems to parse the lines (you actually want to grab) in a predictable manner. tm while(( my $line = <FILEHANDLE>)) { # print "my line is: >$line<", "\n"; if ($line =~ /^\[/) { print "this is a line i need to keep: \n\n"; print "$line\n\n"; my @fields = split '\|', $line; my $date = $fields[1]; print "my date is: $date", "\n"; } } > -----Original Message----- > From: CM Analyst [mailto:cmanal...@yahoo.com] > Sent: Thursday, January 27, 2011 6:25 PM > To: Parag Kalra > Cc: beginners@perl.org > Subject: Re: Need help with Use of uninitialized value in concatenation > (.) or string > > This is a sample of the data I am reading in: > > [#|2011-01-19T07:05:10.734-0800|WARNING|sun- > appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=h > ttpSSLWorkerThread-8080-1;_RequestID=c5cefdc4-4651-4c77-b9e6- > 84f9e0f6609e;|] > com.raec.cq.CQCommitException: You wanted to commit a modifyCR based > record, but the record was not found in the ClearQuest Database. > [#|2011-01-19T07:05:10.734-0800|WARNING|sun- > appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=h > ttpSSLWorkerThread-8080-1;_RequestID=c5cefdc4-4651-4c77-b9e6- > 84f9e0f6609e;|] > com.raec.cq.CQCommitException: You wanted to commit a modifyCR based > record, but the record was not found in the ClearQuest Database. > [#|2011-01-19T07:05:10.734-0800|WARNING|sun- > appserver2.1|javax.enterprise.system.stream.err|_ThreadID=15;_ThreadName=h > ttpSSLWorkerThread-8080-1;_RequestID=c5cefdc4-4651-4c77-b9e6- > 84f9e0f6609e;|] > com.raec.cq.CQCommitException: You wanted to commit a modifyCR based > record, but the record was > not found in the ClearQuest Database. > > > --- On Thu, 1/27/11, Parag Kalra <paragka...@gmail.com> wrote: > > > From: Parag Kalra <paragka...@gmail.com> > Subject: Re: Need help with Use of uninitialized value in concatenation > (.) or string > To: "CM Analyst" <cmanal...@yahoo.com> > Date: Thursday, January 27, 2011, 6:03 PM > > > Ok. Post sample from the log file to entire list. :) > > > Cheers, > Parag > > > > > On Thu, Jan 27, 2011 at 4:02 PM, CM Analyst <cmanal...@yahoo.com> wrote: > > Yes, changiing to $line does not make a difference. > > > On Thu Jan 27th, 2011 5:31 PM CST Parag Kalra wrote: > > >No problem. :) > > > >But are you still facing the issue? > > > >Cheers, > >Parag > > > > > > > >On Thu, Jan 27, 2011 at 3:27 PM, CM Analyst <cmanal...@yahoo.com> wrote: > > > >> Lack of experience :-( > >> > >> --- On *Thu, 1/27/11, Parag Kalra <paragka...@gmail.com>* wrote: > >> > >> > >> From: Parag Kalra <paragka...@gmail.com> > >> Subject: Re: Need help with Use of uninitialized value in concatenation > (.) > >> or string > >> To: "CM Analyst" <cmanal...@yahoo.com> > >> Cc: beginners@perl.org > >> Date: Thursday, January 27, 2011, 4:45 PM > >> > >> > >> When you are already storing the line under $line > >> >>>while(( my $line = <FILEHANDLE>)) { > >> > >> Then why are you using $_ > >> >>>my @fields = split '\|', $_; > >> > >> Cheers, > >> > Parag > >> > >> > >> > >> On Thu, Jan 27, 2011 at 12:57 PM, CM Analyst > <cmanal...@yahoo.com<http://us.mc380.mail.yahoo.com/mc/compose?to=cmanalys > t...@yahoo.com> > > >> > wrote: > >> > >> Hello, > >> > >> In the following script my goal is pull the date value each time an > error > >> value (hardcoded) is found in the specified log file. The script > retrieves > >> the error value without a problem but I cannot seem get the date value. > Can > >> anyone tell me what I need to do? > >> > >> The error message when I run the script is: > >> > >> Use of uninitialized value in concatenation (.) or string at > script.plline 32 > > > > >> > >> where line 32 is where I am calling this: > >> > >> "print $date"; > >> > >> Here is the script: > >> > >> use warnings; > >> use strict; > >> > >> #Specify the path to the log file you want to read, for ex. application > >> log# > >> > >> open (FILEHANDLE, 'd:/scripts/server2.log') or print "Can't Open > File!!!"; > >> > >> while(( my $line = <FILEHANDLE>)) { > >> > >> #Searching for keywords from application log# > >> > >> if (($line =~ m/CQCommitException/i ) || ($line =~ m/Communication link > >> failure/i)) { > >> > >> my @fields = split '\|', $_; > >> my $date = $fields[1]; > >> > >> print $date; > >> > >> #prints $line to file > >> open (my $outfile, ">>", "d:/scripts/loginfo.txt") or > die "Can't open > >> loginfo.txt: $!"; > >> > >> print $outfile "$date, $_\n"; > >> > >> #close $outfile or die "$outfile:$!"; > >> > >> } > >> } > >> > >> my $outfile = 'd:/scripts/loginfo.txt'; > >> > >> #To send or not to send - file size check > >> > >> #Delete file when done > >> #unlink 'd:\scripts\loginfo.txt'; > >> > >> -END- > >> > >> > >> > >> > >> -- > >> To unsubscribe, e-mail: beginners- > unsubscr...@perl.org<http://us.mc380.mail.yahoo.com/mc/compose?to=beginner > s-unsubscr...@perl.org> > >> For additional commands, e-mail: beginners- > h...@perl.org<http://us.mc380.mail.yahoo.com/mc/compose?to=beginners- > h...@perl.org> > >> http://learn.perl.org/ > >> > >> > >> > >> > >> > > > > > > > > > > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ > -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/