Quote:
chomp " $cvar , $rvar , $tvar ";
|
That won't work. You're only passing one argument to chomp, and it's a string composed of each of your variables separated by a comma and a space. It's syntactically valid, but it does nothing. You're going to leave the return characters on the end of each of those $vars.
You should instead be getting your input like this:
chomp(my $cvar = <STDIN>);
That'll chomp DURING the assignment. You also save a line, which is important when you're playing Perl Golf.
And now that you know the ** operator, that formula should be a one-liner too.