in reply to Perl length if condition not working

Your script does print Fail. But my guess is that rather than get '123456789' from the code you get it from STDIN (something like $param_value = <>;) which would mean there is a \n character at the end. You can solve this like that:

chomp($param_value);

If that's not your issue, you'll have to show us code where the problem is actually present. See How do I post a question effectively?.

Edit: you would be able to see the extra char with either of these:

use Data::Dumper; $Data::Dumper::Useqq = 1; ... print Dumper $param_value;
or
use Data::Dump "pp"; ... pp $param_value;
I personally prefer Data::Dump, but Data::Dumper should already be installed on your machine.