We have observed a large sample of compact planetary nebulae in the near-infrared to determine how the 2^1P-2^1S HeI line at 2.058um varies as a function of stellar effective temperature, Teff. The ratio of this line with HI Br g at 2.166um has often been used as a measure of the highest Teff present in a stellar cluster, and hence on whether there is a cut-off in the stellar initial mass function at high masses. However, recent photoionisation modelling has revealed that the behaviour of this line is more complex than previously anticipated. Our work shows that in most aspects the photoionisation models are correct. In particular, we confirm the weakening of the 2^1P-2^1S as Teff increases beyond 40000K. However, in many cases the model underpredicts the observed ratio when we consider the detailed physical conditions in the individual planetary nebulae. Furthermore, there is evidence that there is still significant 2^1P-2^1S HeI line emission even in the planetary nebulae with very hot (Teff>100000K) central stars. It is clear from our work that this ratio cannot be considered as a reliable measure of effective temperature on its own.