in reply to Text output is on one line

If you undefine line separator (undef $/;) than whole file will be red as one line ($bookfile_contents = <FILE>;)

If you want to read from file line by line than use

if(-f "$bookfile"){ open(FILE, "+<$bookfile") || &debug("Oops, I cannot read the bookfile $bookfile: $!"); if($opsys eq "unix"){flock(FILE, 2);} else{binmode(FILE);} while (my $line = <FILE>) { # do something with one line } }

What does mean $/ = "tr/\n /";? Your line will end with following text? I don't think so.

tr/ /