in reply to Dynamically create a format definition

My second edition camel book shows how to do it. The critical points are: 1) put the output of the format statement into a variable, 2) eval that variable. Here is a piece of demonstration code. I have tried to make it readable, it is surely not the most compact version possible.
$data = qw( aaa bbb ccc ); $fields = scalar @data; $data_fields = ""; map $data_fields .= '"' . $_ . '"', @data; $format = "format STDOUT = \n" . "@<<< " x $fields . "\n" . $data_fields . "\n"; . ".\n"; eval $format; write;
HTH, --traveler