And there's always
format(
perlform)... Modifying
ikegami's first example slightly:
my @header = qw( TABNAME 06100 01010 06000 00110A );
my @data = qw(
!W31801!-->!919!-->!90200809!-->!840!-->!MO!
!W31801!-->!919!-->!902008!-->!74!-->!MO!
);
my @fields; #declare here so it's visible to format below
foreach my $line (@data) {
@fields = split(/-->/, $line);
write;
}
format STDOUT_TOP =
@<<<<<<<<< @<<<<<<<<< @<<<<<<<<< @<<<<<<<<< @<<<<<<<<<
@header
.
format STDOUT =
@<<<<<<<<< @<<<<<<<<< @<<<<<<<<< @<<<<<<<<< @<<<<<<<<<
@fields
.