############################################################################
my $st = $dbh->prepare("mysql -u root -p < rr.sql") or die "$DBI::errstr\n";
############################################################################
Line 2 is where you're broken.
The string that you feed to prepare is supposed to be the actual SQL. You've fed it a shell command intended to run mysql. So take the contents of rr.sql, put it in a variable (either have your program read it in, or copy/paste it), and then call prepare() on the variable.
my $ferret_query = "select name, dob, type from ferret order by dob";
my $sth = $dbh->prepare($ferret_query);
$sth->execute()