in reply to splitting on new-line characters

Check $array actually has some newlines in it, as that code should work fine e.g
my $str = <<TXT; foo bar baz TXT print "[$_]" for split /\n/, $str; __output__ [foo][bar][baz]

HTH

_________
broquaint