in reply to Re^2: last_insert_id did not work
in thread last_insert_id did not work

Ok, that's good to know, and the code you've shown so far is fine, so if you're doing it that way everywhere it's good. Anytime you interpolate strings into SQL is a place for potential quoting and similar issues, which is why I made that comment. Note that there are also modules to help you generate SQL, like SQL::Abstract.