Gavin has asked for the wisdom of the Perl Monks concerning the following question:

Hi Brethren,
In the following I would like to change the increment ++ to a variable value e.g. $Inc = 5;
How would I go about this?
Thank you
for (@UnNum) { my $count = \$_->[0]; exists $triggers{$_} && ++$$count for @{$_->[1]}; } print join "\n", map {"$_->[0]\t " . join ' ', @{$_->[1]}} @UnNum;

Replies are listed 'Best First'.
Re: Increment other than ++
by lima1 (Curate) on Mar 25, 2006 at 13:39 UTC
    exists $triggers{$_} && ( $$count+=$Inc ) for @{$_->[1]};
    update, parenthesis were missing.
Re: Increment other than ++
by xdg (Monsignor) on Mar 25, 2006 at 13:37 UTC
    ($$count += $Inc)

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: Increment other than ++
by ikegami (Patriarch) on Mar 25, 2006 at 20:41 UTC
    Operators are documented in perlop