Best way to have a formatted output with Perl

前端 未结 4 924
鱼传尺愫
鱼传尺愫 2020-12-15 00:24

I want to output strings into eight columns, but I want to keep the spacing the same. I don\'t want to do it in HTML, but I am not sure how to do it normally. Example:

4条回答
  •  情歌与酒
    2020-12-15 01:07

    Here is a live example of Perl6::Form:

    #!/usr/bin/perl
    
    use Perl6::Form;
    
    my @arr = (
        [1..8],
        [9..16],
        [17..24],
    );
    
    foreach my $line (@arr) {
        print form
            "{<<<<<} "x8,
            @{$line};
    }
    

    It will output:

    1       2       3       4       5       6       7       8
    9       10      11      12      13      14      15      16
    17      18      19      20      21      22      23      24
    

提交回复
热议问题