The general technique here is @parts = $string =~ /(.{1,44}(?:,|$))/g; You get chunks of up to 45 characters, ending either with a comma or at the end of the string. If there's a possibility of newlines in your data, just add the /s modifier to the regex.
Jeff japhy Pinyan,
P.L., P.M., P.O.D, X.S.:
Perl,
regex,
and perlhacker How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart