On Aug 17, David T-G said:

>Hmmm...  Well, it wasn't happy.  I got the assignment right, it seems,
>but then I can't use it:
>
>     43 while ( my @row = $result->fetchrow_array )
>     44 {
[snip]
>     52   my (%template,%userdata) ;                            # we must predefine 
> if we're to be slick like this
>     53   (@template{qw(ASCII HTML)},                           # message template
>     54     @userdata{qw(flag EMAIL NAME_FIRST NAME_LAST)})     # user data
>     55       = @row ;
>     56   my $body = parseit(%template,%userdata) ;             # now go and parse
>     57   print "I got '$body' for .$row[3].\n";        ###
>     58 }

>  Can't use string ("ASCII") as a HASH ref while "strict refs" in use at 
> /home/admin/bin/massmail-send-script.pl line 71.
>
>Any thoughts?  Maybe I have to actually pass a reference instead of
>successfully passing a hash (could I have done that?)...

Ding ding ding.  You're passing two hashes (that then become flattened
into just a big list of strings).  Your function then extracts only the
first two (which would be one of either ASCII or HTML) and its
corresponding value in the %template hash.

So yes, explicitly pass references:

  my $body = parseit(\%template, \%userdata);

>% I'd like to say that it's a pleasure helping you.  You know what you want
>
>You'd like to ... but you can't? ;-)

You know those laws nowadays... ;)

>% to do, you know how to explain it, you show your code, you're receptive to
>
>Ah, *that* is just a bit of "knowing how to ask a question" :-)

Yes, and it's a very important bit of knowledge to have.

-- 
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]

Reply via email to