Pipes not working

Hi,

thanks for b4. can anyone tell me why following not working:

noUsers=$(who | cut -d" " -f1 | wc -l)

What i'm trying to do is get a list of logged on users and pass it to 'wc -l' and store the output to a variable. Any ideas?

noUsers=`who | cut -d"  " -f1 | wc -l`

thanks
namish