I am looking to write a script that will open a file data.txt and add a line break after every nth instance of the | delimiter, so that each line contains one observation with all four variables. Basically splitting up and reshaping a single line from wide to long. Thanks for your help.Input:a1|b1|c1|d1|a2|b2|c2|d2|a3|b3|c3|d3|a4|b4|c4|d4Output:   a1|b1|c1|d1|   a2|b2|c2|d2|   a3|b3|c3|d3|  a4|b4|c4|d4
How to add line breaks after every nth instance of a delimiter in perl
text processing;perl