$ pm_substr_and_remainder.pl string[ATATTTATATTAT] offset[0] length[3] left[] extract[ATA] right[TTTATATTAT] joined[TTTATATTAT] ------------------------------------------------------------------------ string[1234567890] offset[0] length[4] left[] extract[1234] right[567890] joined[567890] ------------------------------------------------------------------------ string[1234567890] offset[3] length[4] left[123] extract[4567] right[890] joined[123890] ------------------------------------------------------------------------ string[1234567890] offset[6] length[4] left[123456] extract[7890] right[] joined[123456] ------------------------------------------------------------------------ string[1234567890] offset[9] length[1] left[123456789] extract[0] right[] joined[123456789] ------------------------------------------------------------------------ string[] offset[0] length[1] ! Input string is undefined! at ./pm_substr_and_remainder.pl line 10. ------------------------------------------------------------------------ string[HASH(0x7fbeaa0320a8)] offset[0] length[1] ! Input string is a reference! at ./pm_substr_and_remainder.pl line 11. ------------------------------------------------------------------------ string[] offset[0] length[1] ! Input string has zero length! at ./pm_substr_and_remainder.pl line 13. ------------------------------------------------------------------------ string[1234567890] offset[] length[1] ! Offset is undefined! at ./pm_substr_and_remainder.pl line 14. ------------------------------------------------------------------------ string[1234567890] offset[ARRAY(0x7fbeaa0369d0)] length[1] ! Offset is a reference! at ./pm_substr_and_remainder.pl line 15. ------------------------------------------------------------------------ string[1234567890] offset[not a number] length[1] ! Offset not an integer! at ./pm_substr_and_remainder.pl line 16. ------------------------------------------------------------------------ string[1234567890] offset[1.1] length[1] ! Offset not an integer! at ./pm_substr_and_remainder.pl line 16. ------------------------------------------------------------------------ string[1234567890] offset[10] length[1] ! Offset out of bounds! at ./pm_substr_and_remainder.pl line 18. ------------------------------------------------------------------------ string[1234567890] offset[1] length[] left[1] extract[234567890] right[] joined[1] ------------------------------------------------------------------------ string[1234567890] offset[1] length[CODE(0x7fbeaa036df0)] ! Length is a reference! at ./pm_substr_and_remainder.pl line 20. ------------------------------------------------------------------------ string[1234567890] offset[1] length[not a number] ! Length not an integer! at ./pm_substr_and_remainder.pl line 21. ------------------------------------------------------------------------ string[1234567890] offset[1] length[1.1] ! Length not an integer! at ./pm_substr_and_remainder.pl line 21. ------------------------------------------------------------------------ string[1234567890] offset[-3] length[2] left[1234567] extract[89] right[0] joined[12345670] ------------------------------------------------------------------------ string[1234567890] offset[0] length[10] left[] extract[1234567890] right[] joined[] ------------------------------------------------------------------------ string[1234567890] offset[1] length[10] ! Length out of bounds! at ./pm_substr_and_remainder.pl line 31. ------------------------------------------------------------------------ string[1234567890] offset[0] length[-10] ! Negative length out of bounds! at ./pm_substr_and_remainder.pl line 24. ------------------------------------------------------------------------ string[1234567890] offset[3] length[-6] left[123] extract[4] right[] joined[123] ------------------------------------------------------------------------ string[1234567890] offset[3] length[-7] ! Offset out of bounds for negative length! at ./pm_substr_and_remainder.pl line 27. ------------------------------------------------------------------------ string[1234567890] offset[5] length[0] left[12345] extract[] right[67890] joined[1234567890] ------------------------------------------------------------------------