in reply to split a string into four parts on comma

using a regex:

use warnings; use strict; my $string = "TE=ASR,EV=R,PPF=G1,TG=G1,TMT=P1,RTV=YE,AAT=0,AT=105,ON=Y +,CF1=FGOC"; my $width = int (length ($string) * 0.28); my @parts = $string =~ m/(.{1,$width},)(.{1,$width},)(.{1,$width},)(.* +)/; print join "\n", @parts;

Prints:

TE=ASR,EV=R,PPF=G1, TG=G1,TMT=P1, RTV=YE,AAT=0, AT=105,ON=Y,CF1=FGOC

DWIM is Perl's answer to Gödel