Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!zaphod.mps.ohio-state.edu!mips!apple!veritas!amdcad!sono!porky!mayer From: mayer@sono.uucp (Ronald &) Newsgroups: comp.lang.perl Subject: Re: strange (IMHO) eval behavior [summary] Message-ID: Date: 31 May 91 16:03:35 GMT References: Sender: mayer@sono.uucp (Ronald Mayer) Distribution: comp Organization: Acuson; Mountain View, California Lines: 9 In-Reply-To: mayer@sono.uucp's message of 30 May 91 15:08:35 [In a recent mail message I asked people to explain this behavior:] > >% perl -e '@a = eval ("*\n"); print "@a\n";' >[A bunch of random control characters which don't mean anything to me.] > >% perl -e '@a = eval ("*\n"); print "@a";' >*main' > Thanks to a number of you for pointing out that *\n is a reference to a variable called "\n". The bunch of random characters occured from the print statement when I try to print a "\n" concatenated with the "unprintable binary data" contained in the *name value. # perl -e '$\ = "Almost another Perl hacker,"; print $\ ' Ron Mayer mayer@sono.uucp sun!sono!mayer [Note: mandantory "\n" after each $ Why does this JAPH return "Almost another Perl hacker," from csh and "> > Almost another Perl hacker,Almost another Perl hacker,$" from sh? [My guess: In sh the "\n" doesn't need to be '\' quoted, so from sh I'm actually setting '$\' instead of $"\n".] ]