in reply to Re^2: N/A replacement not working
in thread N/A replacement not working

The difference is that his if-else actually does something to the data while your if-else is practically a no-op (i.e. it does nothing except testing the values)

Are you sure that what you see as 'N/A' on the screen is not really "N/A\n" or ' N/A '? Also you test $h[$i], but print $h[1].