Ken Tozier <[EMAIL PROTECTED]> wrote: : : my %wombatStats = GetWombat(); : my $description = DescribeCritter(\% wombatStats);
my $description = DescribeCritter(\%wombatStats); I didn't try it but I don't think the space after '%' is a good idea. It is a good idea to get in the habit of passing references to and from subroutines. : print $description; : : sub DescribeCritter : { : my %input_rec = $_[0]; Since you passed a reference into the sub you can use a scalar to "catch" it: my $kind = $record->{kind_of_animal}; $kind = $kind =~ /^[aeiou]/i ? "an $kind" : "a $kind"; return "$record->{name} is $kind whose favorite pastime " . "is eating $record->{favorite_food} and " . "$record->{favorite_hobby} on the beach in " . "$record->{favorite_vacation_spot}."; : my $result = ""; : : $result .= $input_rec{'name'} : $result .= ' is a '.$input_rec{'kind_of_animal'} : $result .= ' whose favorite past time is eating '. : $input_rec{'favorite_food'} : $result .= ' and '. $input_rec{'favorite_hobby'} : $result .= ' on the beach in '. : $input_rec{'favorite_vacation_spot'} : return $result; : } : : sub GetWombat : { : my %result = (); : $result{'kind_of_animal'} = "wombat"; : $result{'name'} = "Theodore"; : $result{'favorite_food'} = "nachos"; : $result{'favorite_hobby'} = "burping"; : $result{'favorite_vacation_spot'} = "Cancun"; : return %result; : } Just as it is usually better to pass a reference into a sub it is usually better to pass a reference out. return \%result; or: sub GetWombat { return { kind_of_animal => 'wombat', name => 'Theodore', favorite_food => 'nachos', favorite_hobby => 'burping', favorite_vacation_spot => 'Cancun', } } which just sends an anonymous hash. Call these like this: my $wombatStats = GetWombat(); my $description = DescribeCritter( $wombatStats ); print $description; HTH, Charles K. Clarkson -- Head Bottle Washer, Clarkson Energy Homes, Inc. Mobile Home Specialists 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]