in reply to Grabbing source table names from a SQL query

If you only need to handle fairly straightforward queries you can probably get away with using a regular expression to pull out the table names. Something like this should probably work:

my @tables = $query =~ /(?:FROM|JOIN)\s+(\w+)/gi;

If you want to handle more cases, there are a number of SQL parsing modules available on CPAN, such as the one recommended by wfsp above.

-- David Irving