my %sub = { ">" => "\t\t++k;\n", "+" => "\t\t++*k;\n", ... # fill as needed }
The hash initialization statement above should use parentheses and not curlies:
my %sub = ( ... );
s/(.)/$sub{$1}/ge
Also note that the /e modifier is not needed in this substitution (although it does no harm except to burn some time) because $sub{$1} is already a scalar that can be interpolated into a string.
Give a man a fish: <%-{-{-{-<
In reply to Re^2: Weird substitution, missing output
by AnomalousMonk
in thread Weird substitution, missing output
by timpoiko
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |