如何在 Perl 中输出文本表? [英] How do I output a text table in Perl?

查看:20
本文介绍了如何在 Perl 中输出文本表?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想输出一个包含四个变量的表格,所需格式的示例是:

I want to output a table containing four variables, an example of the desired format is:

A confusion matrix

H        |    P     |
-----------------------
$var1    |   $var2  | H
$var3    |   $var4  | P

我遇到的问题是,根据变量中的位数,格式会发生变化,并且各个行会发生偏移.我知道这是一个完整的菜鸟问题,但我以前从未过多关注输出的格式,这只是我这次想要做的那些小事之一.任何帮助都会很棒,谢谢.

The problem I am having is that depending on the number of digits in the variables, the format changes and the various lines are offset. I know this is a complete noobie question, but I have never had to pay too much attention to the format of output before, its just one of those little things I want to get right this time. Any help at all would be great, thanks.

推荐答案

Text::Table, Text::SimpleTable::AutoWidth

这篇关于如何在 Perl 中输出文本表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆