when to use '&' Was: Passing a hash to a function

2006-07-19 Thread Bjørge Solli
On Tuesday 18 July 2006 18:05, Rob Dixon wrote: > Bjørge Solli wrote: > > On Tuesday 18 July 2006 16:45, John W. Krahn wrote: > >>Leonid Grinberg wrote: > >>>sub function > >>>{ > >>> my %operating_systems = &populate_hash(%operating_systems); > >> > >> my %operating_systems = populate_hash

Re: Passing a hash to a function

2006-07-18 Thread John W. Krahn
Rob Dixon wrote: > > I am surprised that the Llama book encourages coding in this way as the > ampersand has been undesirable for a long time. Do you have the latest > edition - > the third? The fourth. http://www.oreilly.com/catalog/learnperl4/index.html John -- use Perl; program fulfillment

Re: Passing a hash to a function

2006-07-18 Thread Rob Dixon
Bjørge Solli wrote: > > On Tuesday 18 July 2006 16:45, John W. Krahn wrote: > >>Leonid Grinberg wrote: >> >>>sub function >>>{ >>> my %operating_systems = &populate_hash(%operating_systems); >> >> my %operating_systems = populate_hash(%operating_systems); > > > Why do you want to remove the amper

RE: Passing a hash to a function

2006-07-18 Thread Ryan Frantz
> -Original Message- > From: John W. Krahn [mailto:[EMAIL PROTECTED] > Sent: Tuesday, July 18, 2006 11:48 AM > To: Perl Beginners > Subject: Re: Passing a hash to a function > > Bjørge Solli wrote: > > On Tuesday 18 July 2006 16:45, John W. Krahn wrote

Re: Passing a hash to a function

2006-07-18 Thread John W. Krahn
Bjørge Solli wrote: > On Tuesday 18 July 2006 16:45, John W. Krahn wrote: >>Leonid Grinberg wrote: >>>sub function >>>{ >>> my %operating_systems = &populate_hash(%operating_systems); >> my %operating_systems = populate_hash(%operating_systems); > > Why do you want to remove the ampersand? In /th

Re: Passing a hash to a function

2006-07-18 Thread Bjørge Solli
On Tuesday 18 July 2006 16:45, John W. Krahn wrote: > Leonid Grinberg wrote: > > sub function > > { > > my %operating_systems = &populate_hash(%operating_systems); > > my %operating_systems = populate_hash(%operating_systems); Why do you want to remove the ampersand? In /the Llama book/, includ

Re: Passing a hash to a function

2006-07-18 Thread John W. Krahn
Leonid Grinberg wrote: > Hello all, Hello, > I have a question about passing a hash to a fucntion. Suppose you had > the following script: > > > sub function > { > my %operating_systems = &populate_hash(%operating_systems); my %operating_systems = populate_hash(%operating_systems); > do_

RE: Passing a hash to a function

2006-07-18 Thread Jeff Peng
sub function { my %operating_systems = &populate_hash(%operating_systems); do_something_with_hash(); } sub populate_hash { my %operating_systems = ?; $operating_systems{"microsoft"} = "Windows"; $operating_systems{"apple"} = "Macintosh"; ... return %operating_systems; } What should t

Passing a hash to a function

2006-07-18 Thread Leonid Grinberg
Hello all, I have a question about passing a hash to a fucntion. Suppose you had the following script: sub function { my %operating_systems = &populate_hash(%operating_systems); do_something_with_hash(); } sub populate_hash { my %operating_systems = ?; $operating_systems{"microsoft"} =