Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!mips!bridge2!cook.ESD.3Com.COM!marcl From: marcl@ESD.3Com.COM (Marc Lavine) Newsgroups: comp.lang.perl Subject: Is it legal to assign an array to @_ inside a subroutine? Message-ID: Date: 25 May 91 05:58:27 GMT Sender: news@bridge2.ESD.3Com.COM Lines: 37 Nntp-Posting-Host: cook.esd.3com.com When I run the enclosed script (with Perl 4.003), I get the following output: @a=9,8,7 @_=9,8,7 @a=1,2,3 @_= instead of what I expected: @a=9,8,7 @_=9,8,7 @a=1,2,3 @_=1,2,3 The assignment of a list to @_ seems to result in @_ becoming empty. Is there something special about assigning to @_ inside a subroutine or have I come across a bug? Any insights would be appreciated. #!/usr/local/bin/perl sub f { @a = @_; print ( "\@a=", join ( ',', @a ), "\n" ); print ( "\@_=", join ( ',', @_ ), "\n" ); @a = ( 1, 2, 3 ); @_ = ( 1, 2, 3 ); print ( "\@a=", join ( ',', @a ), "\n" ); print ( "\@_=", join ( ',', @_ ), "\n" ); } &f ( 9, 8, 7 ); -- Marc Lavine Broken: marcl%3Com.Com@sun.com Smart: marcl@3Com.Com UUCP: ...{sun|decwrl}!3Com.Com!marcl