Now how do i use this above...
print "$#greater+1" ?
does not work because you have quotes around it. Operators like + do not get executed inside quotes. Anyhow, it is not the greatest way to find the number of elements in an array, use the array in scalar context instead. There are many ways to do this, one of the less obscure is: print scalar(@greater),"\n";