On Mon, 4 Jun 2012, Matt Simerson wrote:

> +    my $count = $self->connection->notes('unrec_cmd_count') || 0;
> +                           $self->connection->notes('unrec_cmd_count', 
> ++$count );
> 
> Which does increment correctly.
> 
> This also works (note the parens), which is how it was done before. 
> 
> +    my $count = ($self->connection->notes('unrec_cmd_count') || 0) + 1;
> +                           $self->connection->notes('unrec_cmd_count', 
> $count );
> 
> Which one is easier to read and maintain?  Both seem equal to the task.

I would prefer:

    my $count = $self->connection->notes('unrec_cmd_count') || 0;
    $self->connection->notes('unrec_cmd_count', $count + 1);

Do you have a reason for the unconventional whitespace formatting?

Reply via email to