Path: utzoo!attcan!uunet!fernwood!decwrl!ucbvax!tut.cis.ohio-state.edu!mailrus!usenet.ins.cwru.edu!cwjcc!ncoast!allbery From: allbery@NCoast.ORG (Brandon S. Allbery) Newsgroups: comp.lang.perl Subject: Re: simple script to write a file core dumps, why? Message-ID: <1990Mar10.031257.25691@NCoast.ORG> Date: 10 Mar 90 03:12:57 GMT References: <257@cmic.UUCP> Reply-To: allbery@ncoast.ORG (Brandon S. Allbery) Followup-To: comp.lang.perl Organization: North Coast Public Access UN*X, Cleveland, OH Lines: 33 As quoted from <257@cmic.UUCP> by garvey@cmic.UUCP (Joe Garvey): +--------------- | It sends information to the screen instead of the file, and then core | dumps (ie stops dead). The requested file is created, but has 0 bytes. | Any ideas? Any ideas on where to look in the perl sources. It passed all its | tests ok. I'm still kinda new to perl, have I done something wrong? +--------------- Yup. You aren't using the filehandle right. +--------------- | printf(, "%s\n", $header[$i]); #this goes to the screen, too +--------------- The syntax reads or writes a line from/to the file. Functions like print, printf, close, etc. take unadorned filehandles: printf(wow, "%s\n", $header[$i]); # works +--------------- | close (); +--------------- Same bug. Try "close(wow);". However, I do admit that a core dump is not the best of diagnostics.... Just another Perl diver, ;-) ++Brandon -- Brandon S. Allbery (human), allbery@NCoast.ORG (Inet), BALLBERY (MCI Mail) ALLBERY (Delphi), uunet!cwjcc.cwru.edu!ncoast!allbery (UUCP), B.ALLBERY (GEnie) BrandonA (A-Online) ("...and a partridge in a pear tree!" ;-)