John, Thx for your inputs.
1st i/p: Iam afraid, I cant read each line from array problemLines to outLine. 2nd i/p: =~ /"([^"]+)"/g;------What is the logic in this expression? Can u bit ellaborate. I wanted to read the values in double quotes, from each line. And , Iam using this logic ---if ($outLine =~ / cleartool: Error: Unable to create label /) , to check for the patten in part of line..Is this correct? Thanks & Regards, Pradeep. ----- Original Message ---- From: John W. Krahn <[EMAIL PROTECTED]> To: Perl Beginners <[email protected]> Sent: Wednesday, 25 October, 2006 12:11:02 PM Subject: Re: Fw: Reg:need to find the particular pattern in a line and assign to variables. pradeep reddy wrote: > Hello all, Hello, > Iam new member to this group and also beginner to PERL. > Here is my question,plz let me know your inpus: > I have a PERL script which gives error report at the end. > Here is the output. > > cleartool: Error: Unable to create label "Pradeep" on > "/vob/rootinclude/paer.c" version "/main/3". > cleartool: Error: Unable to create label "Pradeep" on > "/vob/rootinclude/pcme.h" version "/main/2". > > I need to grab the two elements between the two quotes. > Iam very much beginer to the PERL script. > Iam trying this bit of code, not sure how to go on. > > foreach (@problemLines) { > push $outLine,@problemLines; /"here Iam trying to get the each line into > outLine"/ The first argument to push() must be an array so that will not work. > if ($outLine =~ / cleartool: Error: Unable to create label /) { /"here > Iam trying to match the pattern"/ > my @values = split(' " ',$outline); /"Here Iam splitting the outline"/ > my $pathName = @values[3]; > my $Version = @values[5]; > cleartool mklabel $RECURSE $REPLACE -version $Version $labelName $pathName; > /"This is the comand Iam using"/ > print "$_\n"; > > } You probably want something like this: my ( $labelName, $pathName, $Version ) = $outline =~ /"([^"]+)"/g; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response> __________________________________________________________ Yahoo! India Answers: Share what you know. Learn something new http://in.answers.yahoo.com/
