If you're entering and leaving Puglia from Italy, it's easy to do so via train, as there's a major station in Bari. If you're coming from a different country, you'll likely fly in and out of Bari or Brindisi, which is about a 1.5-hour train from Bari and a half-hour train from Lecce.