Hacker News new | ask | show | jobs
by shawn_w 807 days ago
Easily, though you don't need to drag external programs like fmt into it - perl comes with a standard module for word wrapping.

Text::Balanced (for extracting the quoted text) and Text::Wrap would be the core of such a program.

https://perldoc.perl.org/Text::Balanced

https://perldoc.perl.org/Text::Wrap

1 comments

Could you write it for me as a one-liner? I’d like to learn more Perl and this would help.
Oh, I wouldn't try to squeeze it down into a one liner. Maybe for a simple definition of the quoted text that doesn't need to account for edge cases like escaped quotes inside...
Just a normal program then? No edge cases needed