in reply to Dynamically create a format definition


Have a look at the formline function and the accumulator $^A.

Here is a short, seasonal, example that centres the elements of an array on separate lines. The format is built dynamically.

#!/usr/bin/perl -w use strict; my @a = qw(* *** ***** ******* ********* *); formline(('@'.('|'x72)."\n")x@a, @a); print $^A;

--
John.