[comp.lang.perl] Another

piet@cs.ruu.nl (Piet van Oostrum) (03/19/90)

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')