in reply to Simple length question

Having no idea where $compname comes from, what err() does, or what $errmsg is for, it's kind of hard to help you here. This case works exactly as expected:

sub foo { print "Foo!\n"; } my $string = 'completelycoveredinchocolate'; foo if (length($string) < 6);

Your example is substantively different only in that we can't see what you've done with your string. So I reckon that's your problem. Try outputting it. Try outputting its length. It's a technique very broadly called 'instrumentation', and is the easiest way to debug small projects.