Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!mcsun!hp4nl!ruuinf!cs.ruu.nl From: piet@cs.ruu.nl (Piet van Oostrum) Newsgroups: comp.lang.perl Subject: Another (?) Strange behavior with "local" Keywords: local bug Message-ID: <2669@ruuinf.cs.ruu.nl> Date: 19 Mar 90 08:59:21 GMT References: <1363@frankland-river.aaii.oz.au> Sender: news@ruuinf.cs.ruu.nl Reply-To: piet@cs.ruu.nl (Piet van Oostrum) Organization: Dept of Computer Science, Utrecht University, The Netherlands Lines: 28 In-reply-to: pem@frankland-river.aaii.oz.au (Paul E. Maisano) This could be another case of strange (unexpected) local behaviour: I can certainly explain why it behaves like this. It probably does a sequential rather than a parallel assignment to *b, *c, but I would prefer a parallel. The behaviour of local identifiers should be such that if you rename them, and neither the old names or the new names are referenced as globals in the scope, it should not make any difference. This is just another consequence of the principle of information hiding. Apparently the perl local mechanism doesn't work this way (eiter purposely or accidently). --- script ----------------------------------------------- sub args { local(*b,*c) = @_ ; print "b:" . join(',',@b) . "\n" ; print "c:" . join(',',@c) . "\n" ; } @a = ('a','a','a','a','a') ; @b = ('b','b','b') ; &args(*a,*b) ; --- output ----------------------------------------------- b:a,a,a,a,a c:a,a,a,a,a -- Piet* van Oostrum, Dept of Computer Science, Utrecht University, Padualaan 14, P.O. Box 80.089, 3508 TB Utrecht, The Netherlands. Telephone: +31-30-531806 Uucp: uunet!mcsun!ruuinf!piet Telefax: +31-30-513791 Internet: piet@cs.ruu.nl (*`Pete')