# usual syntax chmod 755, $old or die "Can't chmod $old because: $!\n"; # or using the syntax you have and skipping the # useless $cnt temporary variable if (chmod 0755, $old) { print "changed file permissions for $old
"; } else { print "cannot change file perms for $old
System says $!
"; }