Surely i can do the same with Perl!
Certainly, and the fact that you're having trouble doing so means there is some difference between the command that works and the one that doesn't, so you'll have to figure out what the differences between the two are. (Consider comparing a successful transaction and an unsuccessful one with Wireshark.)
on port 587, using SSL
Well, that's at least one difference between the code in the root node.
You might want to give the more modern Email::* modules by RJBS a try, for example see Email::Sender::Manual::QuickStart.