in reply to Updating a record based on cookie retrieval

Your major problem is that you are trying to interpolate a function call (cookie("host")) into a double-quoted string and Perl doesn't do that.

However, you are making the logic a lot more complex than it needs to be. I'd do something like this (untested):

my $host = cookie('host'); unless ($db->do("update logs set visits=visits+1 where host='$host')" +> 1) { $db->do("insert into logs values (null, '$host', '$xronos', '$file', + 1)"); }

I've omitted error checking for clarity.

--
<http://www.dave.org.uk>

"The first rule of Perl club is you do not talk about Perl club."
-- Chip Salzenberg

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.