in reply to What is the most efficient way to split a long string (see body for details/constraints)?

If your lines have substantially more fields than 31, you can use the LIMIT parameter to split:

my @fields = split /\t/, $_, 32;

This prevents split from doing unnecessary work, but you should benchmark whether it actually makes a difference.

  • Comment on Re: What is the most efficient way to split a long string (see body for details/constraints)?
  • Download Code

Replies are listed 'Best First'.
Re^2: What is the most efficient way to split a long string (see body for details/constraints)?
by mikegold10 (Acolyte) on Jun 19, 2019 at 15:55 UTC
    OK, so using limit answers my question on early termination (of the parse of each line). But, I don't feel that this is the most important aspect, performance wise, since I do desire a field near the end of the line.