in reply to Re: Comma seperated output
in thread Comma seperated output

while(my $line = <$log>) { $n++; $line =~ tr/\r\n//d; if ($line =~ /^(.*)INFO:.*recvd AA_BIN_MSG_GET_WLT/) { $Time_Stamp = $1; while ( $line = <$log> ) { ... while ( $line = <$log> ) {
I wanted to combine the if statements but if will only select one not all, i want the value for all the variables and then print that values in comma seperated values. This happens quite a number of time in the logfile so wanted to loop through the log file. I have to capture these data in the log file. Arcotid Time Stamp, Username, Success, Failure, Error Code, Error Message In the log snippet the userID can be found in- Code Arcot Native Server: recvd AA_BIN_MSG_VER_CHG Cert Subject String....:CN=01095848;O=MLS; UserID=012345; CardName=ARCARD Success and failure are like this- Code ArcotID Auth SUCCESS (serial Number e93b) Auth fail due to signature verification.Serial Number 11872(This is error message also) Code error code is - Authentication mechanism returned 3, here 3 is error code and for success error code is always 0. Thanks NT

Replies are listed 'Best First'.
Re^3: Comma seperated output
by Corion (Patriarch) on Jun 15, 2009 at 10:01 UTC

    From your description, I can't see a real list of things that the program should do, in order. I interpret your sentences as the following sequence of things to be done:

    1. Read through the file line by line
    2. Whenever there is a "value"
      1. Collect that "value".

    If my interpretation is wrong, please write your own list of what the program should do. Please try to structure that list like I did, by formatting it for example with <ol><li>... tags or <code> tags, so it becomes conveniently readable.

    If my interpretation of your description matches what you want, look at your code and determine where your code does not match the description and write new code that matches the description.