Some thoughts on the OP:
-
You don't show the output you expect from the given input;
-
You don't show the code of the field_split() function in its current state (this has been subsequently supplied here);
-
You don't mention that the indices you're passing to the field_split() function are 1-based and not 0-based.
All these pieces of info would have been useful as the foundation of a helpful answer. Furthermore, a
Test::More testing framework based on the current implementation would have been an enticement to a quick answer as well as a convenient way to present some of the items of information mentioned above; please see
How to ask better questions using Test::More and sample data. See also the
Short, Self Contained, Correct (Compilable), Example.
In short, please help us to help you.
Give a man a fish: <%-{-{-{-<