# [Perl 5] `-p`, <s>56</s> 52 bytes

<!-- language-all: lang-perl -->

 ("$`$'"eq reverse"$`$'")&&($\=pos)while/./g}{$\||=-1

[Try it online!][TIO-jzqlasg7]

[Perl 5]: https://www.perl.org/
[TIO-jzqlasg7]: https://tio.run/##K0gtyjH9/19DSSVBRV0ptVChKLUstag4FcLXVFPTUImxLcgv1izPyMxJ1dfTT6@tVompqbHVNfz/vygxObUoObHoX35BSWZ@XvF/XV9TPQNDg/@6BTkA "Perl 5 – Try It Online"