Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Dynamically create a format definition

by jmcnamara (Monsignor)
on Dec 13, 2001 at 19:54 UTC ( [id://131640]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://131640]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-20 00:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found