Have you tried www.voyages-sncf.com?
Looking on there, unfortunately both the TGVs at 08:16 and 12:22 are full on 8th and 9th August. However there is space on the 16:42, with singles from €39. Journey time for the TGV is about three hours.
However you can get a local train from Barcelona to Cerbere, the first station on the French side of the border, from where you can change to another train to Perpignan. These trains take about four hours for the whole journey, and do not have to be booked in advance.
There is a departure from Barcelona at 09:16 on 8th August which arrives Perpignan at 13:35.
See http://www.bahn.com/i/view/GBR/en/index.shtml for information on train times. Although it is a German site, it contains information on train times throughout Europe.