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

You can do what you want without creating an array by using a list slice:

# Copy only the desired fields to create a new # line in TSV format # This can be done in one simple step in Perl, using # list slices and the join() function my $new_line = join "\t", ( split /\t/, $_ )[ 2, 3, 12 .. 18, 25 .. +28, 31 ]; # ...
  • 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 Anonymous Monk on Jun 21, 2019 at 18:39 UTC
    If this in fact prevents a list temporary object from being created (i.e., slices in-place), it is an interesting approach I will consider...