steph1 Posted August 5, 2010 Share 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 Link to comment Share on other sites More sharing options...
PsaltyDS Posted August 5, 2010 Share 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 Link to comment Share on other sites More sharing options...
steph1 Posted August 5, 2010 Author Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now