in reply to Alternative to substr on unknown length of scalar

Since these kind of questions always turn into a "let's see how many different alternatives we can come up with" contest, here's my entry:

for (@lines) { $_ = sprintf "%-6s", /(.{0,6})/; }