Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!wuarchive!psuvax1!news From: flee@cs.psu.edu (Felix Lee) Newsgroups: comp.lang.perl Subject: Re: print ; Message-ID: <$dG&j&j1@cs.psu.edu> Date: 8 Apr 91 08:30:53 GMT References: <1268@sicsun.epfl.ch> Sender: news@cs.psu.edu (Usenet) Organization: Penn State Computer Science Lines: 24 Nntp-Posting-Host: guardian.cs.psu.edu Welcome to the wonderful world of scalar vs. array contexts. You can force a scalar context with the scalar() builtin: print scalar(); Does anyone have a complete list of places where scalar and array contexts are forced? Here's an incomplete list: A = forced array context; S = forced scalar context @x = A; %x = A; $x = S; $x[S]; @x[A]; $x{S}; @x{A}; ($x, $y) = A; scalar(S); anylistfunction(A); anyotherfunction(S, ...); &subroutine(A); do subroutine(A); S binaryoperator S; unaryoperator S; -- Felix Lee flee@cs.psu.edu