That code you have isn’t Perl. Here’s what might look more like Perl:
my $vmVersion = `defaults read '/Applications/VMware Fusion.app/Contents/Info' CFBundleShortVersionString`;
if ($vmVersion > 8.4) {
print "compliant";
} else {
print "update required";
}
Note two things:
- Version numbers are not floating point numbers. You should really use a semantic version library, such as SemVer, for version comparison.
- Your messages should probably include newline characters (
\n
). Without those, when a user runs your program, their prompt will print in a funny location afterwards. 🙂
2
solved new to Perl – having trouble with a floating point comparison