简体   繁体   中英

Is there a module that prints a list like `ls -C`?

Is there a module that prints (or helps me printing) a list whose elements are strings (scalars) in a ls -C fashion?

Something like the following imaginary program:

use strict; use warnings;

use Unknown::Module;

my $ls = new Unknown::Module (columns => 3);

$ls -> print_ls_C qw(abc def ghi jklmnop q rst uv wxy z);

The output should then be something like

 abc  jklmnop  uv
 def  q        wxy
 ghi  rst      z
use Perl6::Form;
my $cols = shift || 3;
my @list = qw(abc def ghi jklmnop q rst uv wxy z);
print form   q/ {:[{*}[:} / x $cols, ( \@list ) x $cols ;;;
__END__
abc                      jklmnop                  uv
def                      q                        wxy
ghi                      rst                      z

This is from example demo_columns , see more examples in https://metacpan.org/source/DCONWAY/Perl6-Form-0.04/demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM