how do i get the number of attached hard disks in HP-UX
You don't state HP-UX version or whether you are familiar with "sam" or "samx", so please do check the manual first:
General answer for root user:
ioscan -fnCdisk
Then eliminate any non-disk devices such as DVD-ROM and any disk devices not marked as "CLAIMED".