我的脚本在终端输出的不同行上打印数据,如下所示:
Name: Paul Surname: Doe Age:34
Name: Paulo Surname: Doeson Age:28
Name: Paulinho Surname: Docsone Age:5
Name: Paulmen Surname: Doee Age:12
Name: Paulchen Surname: Dooe Age:31
我希望将所有数据分成列并在条形图中显示,如下所示:
Name: Paul Surname: Doe Age:34
Name: Paulo Surname: Doeson Age:28
Name: Paulinho Surname: Docsone Age:5
Name: Paulmen Surname: Doee Age:12
Name: Paulchen Surname: Dooe Age:31
我注意到输出无法缓冲或存储。我想在运行脚本时实时实现这一点。有没有任何技巧来实现这一目标?比如在HTML表格中指定单元格的宽度?
修改
真的示例代码:
@arr = q(Name: Paul Surname: Doe Age:34, Name: Paulo Surname: Doeson Age:28, Name: Paulinho Surname: Docsone Age:5, Name: Paulmen Surname: Doee Age:12, Name: Paulchen Surname: Dooe Age:31);
foreach (@arr) {
# here should be our trick to creating columns
print $_ # should be print element in columns (without buffering). print now, not after loop end.
}