in reply to using perl to get sms messages

Well, the old SL4A (scripting layer for Android) had SMS functions in its API:

SL4A ApiReference

And so, maybe works with perl...

perl-android-apk

If that does not work, look for the not documented "content://sms/inbox"

edit: You also need to dive into: sl4a itself