my $max_len = max( map { length } keys %{$form} );
#!/usr/bin/perl
use List::Util qw( max );
use Perl6::Form;
use Data::Dumper;
my $form = {
'name' => 'mike',
'surname' => 'shmike',
'region' => 'kiev',
};
my @body;
my $max_len = max( map { length } keys %{$form} ) - 2;
foreach my $key ( keys %{$form} )
{
push @body, form(
'{' . ('>' x $max_len) . '}: {' . ('<' x $max_len) . '}',
$key, $form->{$key},
);
# print form(
# '{' . ('>' x $max_len) . '}: {' . ('<' x $max_len) . '}',
# $key, $form->{$key},
# );
}
print Dumper( \@body );
No comments:
Post a Comment