Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!newstop!texsun!convex!convex.COM From: tchrist@convex.COM (Tom Christiansen) Newsgroups: comp.lang.perl Subject: Re: Question regarding variable output formats Message-ID: <110795@convex.convex.com> Date: 12 Dec 90 13:54:24 GMT References: <1990Dec11.221304.2933@tkna.uucp> Sender: usenet@convex.com Reply-To: tchrist@convex.COM (Tom Christiansen) Organization: CONVEX Software Development, Richardson, TX Lines: 38 In article <1990Dec11.221304.2933@tkna.uucp> alan@tkna.tkna.com (Alan Light) writes: :I can't seem to use a variable to specify an output format picture. :Consider the following code: :$myformat = '@<<<<<<<@<<<<<<<<<<<<@<<<<<<<<<<<<@<<<<<<<<<<<@<<<<<<<<<<'; :format STDOUT = :$myformat :$_[0],$_[1],$_[2],$_[3],$_[4] :. :It seems that the string "$myformat" is included verbatim in the output :picture. That's right -- this is how formats work. They alternate lines of literal descriptions with variable references. :I'm running perl 3.0 PL 12 Wow, that's ancienct history. Seems to be what I'm about to suggest doesn't work back then. If you were up to the current (or at least a more recent) patchlevel, you could use an eval: $myformat = '@<<<<<<<@<<<<<<<<<<<<@<<<<<<<<<<<<@<<<<<<<<<<<@<<<<<<<<<<'; eval <