This is documented in perlop:
Because the transliteration table is built at compile time, neither the SEARCHLIST nor the REPLACEMENTLIST are subjected to double quote interpolation. That means that if you want to use variables, you must use an eval():eval "tr/$oldlist/$newlist/"; die $@ if $@;
In your case, this would be:
my $count = (eval "\$inp_row =~ tr/$de//"); die $@ if $@;
In reply to Re: Regex - counting number of '|'
by kyle
in thread Regex - counting number of '|'
by perl_junkie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |