Path: utzoo!attcan!uunet!snorkelwacker!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: dynamic formats Message-ID: <7019@jpl-devvax.JPL.NASA.GOV> Date: 8 Feb 90 06:12:38 GMT References: <5195@convex.convex.com> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 29 In article <5195@convex.convex.com> tchrist@convex.com (Tom Christiansen) writes: : I'm trying to figure out a way to extend the syntax without breaking : anything. If write's syntax were : : write(FILEHANDLE); : or : write(FILEHANDLE, FORMAT); : : where FORMAT were the name of a tagged format field, it could work. # Usage: &write(*FILEHANDLE, 'format-name', 'top-of-form-name'); # or &write(*FILEHANDLE, 'format-name'); sub write { local(*HANDLE,$format,$top) = @_; $oldsel = select(HANDLE); $^ = $top if $top; $~ = $format; select($oldsel); write(HANDLE); } Formats do have their own namespace, as you can see here. It just looks like they don't from the examples because the default format for a filehandle is of the same name. Larry