On Aug 17, David T-G said: >I've gotten rusty and so I'm back again as a rank amateur :-)
That's not very professional of you. ;) > 45 my $body = > 46 &parseit > 47 ( > 48 {ASCII=>$ascii,HTML=>$html}, > 49 {flag=>$flag,EMAIL=>$email,NAME_FIRST=>$fn,NAME_LAST=>$ln} > 50 ) ; First, you can drop the & on the function call. It's not necessary. But this is where the crux of the issue lies... you aren't passing ANY hashes to parseit(), you're passing hash *references*. And as such, you can't expect Perl to magically turn them into hashes for you. > 62 sub parseit > 63 { > 64 my (%template,%userdata) = @_ ; > 65 print "template is .$template.\n"; ### > 66 } You can never extract more than one list (array OR hash) from a list at a time. Watch: ($a, $b, @c) = (1, 2, 3, 4, 5); # $a=1, $b=2, @c=(3,4,5) ($a, @b, $c) = (1, 2, 3, 4, 5); # $a=1, @b=(2,3,4,5) $c=undef ($a, @b, @c) = (1, 2, 3, 4, 5); # $a=1, @b=(2,3,4,5) @c=() An array (or a hash) slurps the rest of the elements of the list. Therefore, even if your code did "work", you'd end up with everything in the %template hash and nothing in the %userdata hash. As it turns out, the %template hash is the only one with stuff in it -- one key (a stringified hash reference) and one value (the user-data hash reference). Here's how to get them: sub parse_it { my ($tmpl, $user) = @_; # hash references are scalars Then you can access the contents in one of two ways: print "user's name is $user->{NAME_FIRST} $user->{NAME_LAST}\n"; or my %template = %$tmpl; # remember, hashes slurp, so we couldn't my %userdata = %$user; # have done (%a, %b) = (%$c, %$d) print "user's name is @userdata{'NAME_FIRST', 'NAME_LIST'}\n"; That @hashname{...} syntax, if you've never seen it, is called a hash slice. It's accessing multiple keys of the hash at the same time. To do it with the hash reference, the syntax is @$user{'NAME_FIRST', 'NAME_LAST'} Also, note that I used SINGLE quotes around the key names, because I'm already using double quotes around the string. I could have said @userdata{qw( NAME_FIRST NAME_LAST )} too. It's up to you. Anyway, there you go. -- Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/ RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/ <stu> what does y/// stand for? <tenderpuss> why, yansliterate of course. [ I'm looking for programming work. If you like my work, let me know. ] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]