Skip to content

Instantly share code, notes, and snippets.

@perlancar
Created August 14, 2021 10:36
Show Gist options
  • Save perlancar/3f191a642dc6ada4ef177d315dd23fb7 to your computer and use it in GitHub Desktop.
Save perlancar/3f191a642dc6ada4ef177d315dd23fb7 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use Text::ANSITable;
use strict;
my %Flag;
foreach (
'durian', 'rambutan', 'salak', 'belimbing', 'mangga'
) { $Flag { $_ } = undef; }
my $tw = 2;
my @ta = ();
my $tb = Text::ANSITable->new;
# $tb->color_theme("Text::ANSITable::Standard::NoGradation");
$tb->columns(["X", "Y"]);
my $i;
foreach $i ( sort keys %Flag ) {
push @ta, $Flag{$i}, $i;
if ((scalar @ta) == $tw) {
$tb->add_row([@ta]);
@ta = ();
}
}
print $tb->draw;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment