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 {
>>
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
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
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
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
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
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]
[EMAIL PROTECTED] (John W. Krahn) writes:
> "Michael R. Wolf" wrote:
[buggy code deleted ...]
> $ perl -le'
> @fred = qw(1 3 5 7 9);
> sub total {
> my $sum;
> $sum += $_ foreach (@_);
> }
# undef from final foreach always returned
> print total( @fred );
> '
>
My ba
"Michael R. Wolf" wrote:
>
> # Readable.
> sub total {
> my $sum;
> foreach my $num (@_) {
> $sum += $num;
> }
> return $sum;
> }
>
> # Streamlined
> sub total {
> my $sum;
> $sum += $_ foreach (@_);# $_ implicitly set
> } # sum implicitly returned
^
[EMAIL PROTECTED] (Dragon Nebula Web Design) writes:
[...]
> In this case, RTFMing is not helping (and I'd rather not
> resort to the answer in the back of the book).
You chose to not look?
Don't let your pride get in the way of working code. AND
also, don't let a simple answer get in the
Okay, first, this is NOT a homework question for the good reason that I
am not currently in college. I am teaching Perl to myself, and I've
managed to make it to the exercises in Chapter Four of the Llama, Third
Edition and I'm stuck. In this case, RTFMing is not helping (and I'd
rather not resort
11 matches
Mail list logo