I'm trying to print each values in a line separately. I want the TCP, ports and CIDR to be printed as array values.
sg_rules="TCP,80,80,0.0.0.0/0
TCP,8080,8080,0.0.0.0/0"
sg_rules.each_line do |rule|
rule.split(',')
print rule[0]
end
But I'm getting the following output. I expected TCP as the result.
Output:
$ruby main.rb
TT