I also am not a serious user of format, and it may be that it does not get as much love lately as it should. Since the format does what you want, another way to handle the problem is just to suppress the warning:
use strict;
use warnings;
use open ':locale';
sub print_data
{
my ($name, @f);
do {
no warnings 'syntax';
format START =
.===================.
|@<<<<<<| |
$name
| | |
.=======.===========.
|@<<<<<<| @<</@>> |~~
splice( @f, 0, 3 )
.=======.===========.
.
};
binmode STDOUT, ':raw:crlf';
my $ofh = select(STDOUT);
$~ = "START";
$name = 'TAB';
@f = ('Step2', 0, 4, 'Step3', 4, 4);
write;
}
print_data;
produces
.===================. |TAB | | | | | .=======.===========. |Step2 | 0 / 4 | |Step3 | 4 / 4 | .=======.===========.
without any warnings. The no warnings ... and format ... were enclosed in a do { ... } simply to limit the scope of the no warnings .... An explicit use warnings 'syntax' after the format would have done the same.
In reply to Re: Avoid warnings while formatting with repeated format lines
by Anonymous Monk
in thread Avoid warnings while formatting with repeated format lines
by hexcoder
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |