fork(4) download
  1. str = "[123, 345, 567]"
  2.  
  3. arr1 = eval(str)
  4. arr2 = str[1..-2].split(',').collect! {|n| n.to_i}
  5.  
  6. print(arr1, " ", arr1.class, " - ", arr2, " ", arr2.class)
  7.  
Success #stdin #stdout 0s 4760KB
stdin
Standard input is empty
stdout
[123, 345, 567] Array - [123, 345, 567] Array