Path: utzoo!attcan!uunet!cs.utexas.edu!sdd.hp.com!elroy.jpl.nasa.gov!jpl-devvax!lwall From: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Newsgroups: comp.lang.perl Subject: Re: print @ar; bug or feature Message-ID: <8319@jpl-devvax.JPL.NASA.GOV> Date: 7 Jun 90 16:52:27 GMT References: <1990Jun7.031545.27669@athena.mit.edu> Reply-To: lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) Organization: Jet Propulsion Laboratory, Pasadena, CA Lines: 23 In article <1990Jun7.031545.27669@athena.mit.edu> ccount@athena.mit.edu (Craig A Counterman) writes: : Is this a bug? It doesn't matter much to me, but someone pointed it : out, an now I really would like to know why this is so. : : perl -e '$ar[0] = 3;$ar[3] = 5;$\="\n";print @ar;print "@ar";' : : prints "33 5". Why? It prints @ar only till it hits an undefined : element, but interpolating the @ar in a string constant works as it : should. print @ar also fails to print the newline. It's a bug, and will be fixed in the next patch. : It looks like 'print @ar' is at some point expanding to : "3\000\000\0005\n", and only the part till the first nul is being : printed. Something like that. Actually, the routine that prints each element of the array was returning FALSE if you tried to print a non-existent element when it should have returned TRUE, so the array value printer aborted in the middle with what it thought was an error. Hmm, I obviously need some coffee. Larry