views:

83

answers:

2

$param=k.chomp.split("\t") how to find the lenght of $param thats is having class array. actully when i m writing puts $param.class i got the o/p like Array. now how to find the length of this array plzz help me i tried with $param.length but its not working

A: 

Try

$param.size

bradgonesurfing
Size is just an alias for length.
Aurril
+1  A: 

Ref Array class

k = "This \t is \t just \t testing"
$param=k.chomp.split("\t")
array_length= $param.length   #or $param.size
puts "legth of $param is : #{array_length}"

o/p

legth of $param is : 4
Salil
thanks salil$param.size is working but $param.length is not working
Amit singh tomar
what is your ruby version?
Salil