in reply to Baseball line up (best rotation)
To do this I would use a DBMS. Yes, you can do it in Perl data structures but if you start out even on this simple project with a hand-rolled solution, you'll end up tearing your hair out when you add features later. (I can easily see any app you'd develop for this specific purpose growing into a general statistical database for the league. Really!)
Fear not, MySQL and PostgreSQL are available for the cost of a download and if you're running a free *nix (linux, bsd), you've probably got it installed already. Learn SQL. Get a copy of Programming the Perl DBI and write a DBI application that manipulates a relational database.
That's short on specifics. I'd actually written somethign about the likely table structure, but my browser crashed. Let's just say you'd want a table for teams, players, and one for at bats. In the 'at bats' table, you store the game, the inning, the batter, the pitcher, the result (walk, strikeout, single, etc.) and the highest base reached. Then you could find out the number of singles Joe's hit against Sue with SQL like
SELECT count(*) FROM at_bat WHERE pitcher='Sue' AND batter='Joe' WHERE + result = 'single';
The SQL for averages would be more complex, but I don't have time to think it out.
This could be a *really fun* project, IMO.
perl -e 'print "How sweet does a rose smell? "; chomp ($n = <STDIN>); +$rose = "smells sweet to degree $n"; *other_name = *rose; print "$oth +er_name\n"'
|
|---|