Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: simple script to write a file core dumps, why? Keywords: perl, hpux 6.5, hp 9000/370, help Message-ID: <7335@jpl-devvax.JPL.NASA.GOV> Date: 8 Mar 90 01:13:49 GMT References: <257@cmic.UUCP> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 37 In article <257@cmic.UUCP> garvey%cmic@mips.com writes: : Followup-To: garvey%cmic@mips.com Don't do that. The inews program has no idea what newsgroup garvey%cmic@mips.com is, and I don't blame it. You just wasted about 5 minutes of my time. Followup-To: is used for redirecting the discussion to another newsgroup. : printf(, "%s\n", $header[$i]); #this goes to the screen, too There are two things wrong with that. First, is not a filehandle. wow itself is the filehandle, and is the input symbol containing the filehandle wow. So the above will input a null string from output filehandle wow, and then print it as the first argument to STDOUT, because the second thing you did wrong was to put a comma after the filehandle, which makes it not a filehandle. What you wanted to say was printf(wow "%s\n", $header[$i]); or printf wow "%s\n", $header[$i]; Better yet, make wow upper case so that if I add a reserved word "wow" you don't have to rewrite your script. And you probably don't want to waste a printf on a format as simple as "%s\n". I'd just say open(WOW, ">wow") || die "Couldn't create wow: $!"; ... print WOW $header[$i], "\n"; This is much more efficient and I think clearer. Admittedly a little less like C... Larry