DATA.each_line - why array header_names does not print "A", "B", "C"?

#1

solved here: https://stackoverflow.com/questions/55519210/data-each-line-not-returning-header-names
Why array header_names does not print “A”, “B”, “C”?

header_names =

this works OK

str = “|X|Y|Z|”
a = str.split(/|/)
p a

DATA.each_line { |e|
if e =~ /|/
header_names = e.split(/|/)
return header_names
end
}
p header_names # why it does not print “A”, “B”, “C”

END
blah blah
|A|B|C|
|1|1|1|
|2|2|2|