Reorder Text With Perl Split and Splice

We were hired to edit some transcriptions. The transcriptions were in different formats. Sometimes the “time” was first, and sometimes the “who” was first. Here is one way to reorder text programatically.

Original Text to Reorder

The client gave us text in the format of “who”,”when”,”what was said”

Desired Output

The client wanted text in the format of “when”,”who”,”what was said”

Reorder Text in Arrays

There is a bit more that was required than what we are showing (commas needed to escaped), but overall, a simple Perl splice was all that was needed:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.