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

solved here: ruby - DATA.each_line - not returning header_names - Stack Overflow
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|