On Sat, Apr 15, 2006 at 06:09:04AM -0700, John W. Krahn wrote: > Chad Perrin wrote: > > On Fri, Apr 14, 2006 at 12:18:33PM -0400, Brian Volk wrote: > >>I'm working through the exercises in the Alpaca book. I don't > >>understand why you have to pass the check_items_for_all subroutine a > >>reference to a hash. Why can't you just pass it the hash itself... > >>check_items_for_all(%all) instead for (\%all) ? Could someone pls > >>explain this to me? > > > > Subroutines take arguments in scalar context. > > LIST context. > > perldoc perlsub > [snip] > The Perl model for function call and return values is simple: all > functions are passed as parameters one single flat list of scalars, and > ^^^^^^^^^^^^^^^^^^^^ > all functions likewise return to their caller one single flat list of > scalars.
You're right. I was very, very sloppy in my thinking there. What I meant to convey is that the elements of list arguments are assigned to a single array as though they were separate scalar arguments. Mea culpa. -- Chad Perrin [ CCD CopyWrite | http://ccd.apotheon.org ] "The first rule of magic is simple. Don't waste your time waving your hands and hopping when a rock or a club will do." - McCloctnick the Lucid -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>