in reply to Re^3: Matching part of a line and saving it into a variable
in thread Matching part of a line and saving it into a variable

That works awesomely! May I ask, what the first if clause does?

if($1 == 0)

I took the regex match and the printing code and replaced the code I had before and it worked marvelously, thanks so much. Now I need to play with the $last $first $mi variables and figure out how to output them into a javascript array. I might be back later on this evening unless I can figure it out.

Replies are listed 'Best First'.
Re^5: Matching part of a line and saving it into a variable
by fidesachates (Monk) on Mar 14, 2011 at 20:48 UTC
    You stated that you didn't want to print the first line. Notice the variable $i is initialized to 0. That if clause checks if the variable $i is equal to 0. Since we initialized it to 0, it enters the clause. The first line increases the variable $i to 1. Then it tells the while loop to skip to the next iteration. Now when you come to the clause this time, it skips it and continues to the rest of the while code because variable $i now equals 1.

    By the way, glad you're asking questions. The more you ask now, the less you'll ask in the long run.