in reply to Retrieving data from db with foreign keys

Is your question about the Perl code you should use or about the SQL that you should use?

For the Perl code, DBI has about everything that you would need. For the SQL, I recommend practicing with Querylet or DBIx::RunSQL or dbish (or the sqlite3 tool) to see the results you get for the various queries.

From your description, I guess that you want to return all users and the respective topics they are interested in. The SQL concept to look up in your course material would be the "JOIN" keyword.