steph1 0 Posted August 5, 2010 I have a perl program that reads a file with baseball scores and calculates pointsFor/pointsAgainst for each team. I would like to rewrite this program in autoit. Problem I am having is adding each teams points (pf/pa) to an array. was 12 at tor 2 sea 7 at kc 2 pit 2 at phi 7 etc.. .... .... Each line is split by team1 score1 where team2 score2 in perl i use $scorePF{$team1} += $score1; add pointsFor whatever the team1 name is on the line $scorePA{$team1} += $score2; add pointsAgainst for team1 $scorePF{$team2} += $score2; $scorePA{$team2} += $score1; Is there a way to do this in autoit or do I have to create a variable for each team/PF/PA. I am still a beginner here in both languages lol, so go easy on me. Thanks steph1 Share this post Link to post Share on other sites
PsaltyDS 39 Posted August 5, 2010 You can certainly create a 2D array, with n rows and 3 columns, where n = number of teams and the columns are: [n][0] = team name, i.e. "was" [n][1] = points for [n][2] = points against In the loop where you evaluate each line of data, you would search column 0 for each team name to get the row index, and then add points to either [n][1] or [n][2], Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites
steph1 0 Posted August 5, 2010 You can certainly create a 2D array, with n rows and 3 columns, where n = number of teams and the columns are: [n][0] = team name, i.e. "was" [n][1] = points for [n][2] = points against In the loop where you evaluate each line of data, you would search column 0 for each team name to get the row index, and then add points to either [n][1] or [n][2], Thanks PsaltyDS for your help, I'll give it a try Share this post Link to post Share on other sites