str = "[123, 345, 567]" arr1 = eval(str)arr2 = str[1..-2].split(',').collect! {|n| n.to_i} print(arr1, " ", arr1.class, " - ", arr2, " ", arr2.class)
Standard input is empty
[123, 345, 567] Array - [123, 345, 567] Array
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!