Re: passing Hash to subroutine help please

2009-12-09 Thread Philip Potter
2009/12/9 John W. Krahn : > Jeff Pang wrote: >> >> Noah: >>> >>> sub exiting { >>>    my ($hostname, %login) = @_; >> >> Passing arguments like this has no such problem. >> But you'd better pass the hash as a reference to the subroutine. >> >> exitint($hostname, \%login); >> >> sub exiting { >>    

Re: passing Hash to subroutine help please

2009-12-08 Thread Jeff Pang
John W. Krahn: Jeff Pang wrote: Noah: sub exiting { my ($hostname, %login) = @_; Passing arguments like this has no such problem. But you'd better pass the hash as a reference to the subroutine. exitint($hostname, \%login); sub exiting { my $hostname = shift; my %login = %{+shi

Re: passing Hash to subroutine help please

2009-12-08 Thread John W. Krahn
Jeff Pang wrote: Noah: sub exiting { my ($hostname, %login) = @_; Passing arguments like this has no such problem. But you'd better pass the hash as a reference to the subroutine. exitint($hostname, \%login); sub exiting { my $hostname = shift; my %login = %{+shift}; What is t

Re: passing Hash to subroutine help please

2009-12-08 Thread Steve Bertrand
Jeff Pang wrote: > Noah: > >> >> sub exiting { >> my ($hostname, %login) = @_; > > Passing arguments like this has no such problem. > But you'd better pass the hash as a reference to the subroutine. ...or bundle _all_ parameters into a hashref, which I've found to be oh so extensible, wi

Re: passing Hash to subroutine help please

2009-12-08 Thread Jeff Pang
Noah: sub exiting { my ($hostname, %login) = @_; Passing arguments like this has no such problem. But you'd better pass the hash as a reference to the subroutine. exitint($hostname, \%login); sub exiting { my $hostname = shift; my %login = %{+shift}; ... } print "logi

Re: passing Hash to subroutine help please

2009-12-08 Thread Jim Gibson
On 12/8/09 Tue Dec 8, 2009 5:41 PM, "Noah" scribbled: > > Hi there List people, > > I am hoping to send a hash and a scalar to a subroutine but the variable > is not completely being sent. Below is the error message below is > showing something is not getting passed that well to the subrouti

passing Hash to subroutine help please

2009-12-08 Thread Noah
Hi there List people, I am hoping to send a hash and a scalar to a subroutine but the variable is not completely being sent. Below is the error message below is showing something is not getting passed that well to the subroutine. Looks like %login is empty. --- snip --- $ret{$hostnames[0]