local $/= undef; # read entire file at once my @text=; #### my $data; open(FH,'<',$file) || die "Oops $!"; local $/ = undef; $data = ; close(FH); #### use strict; use warnings 'all'; # Uncomment this to see what I mean # local $/ = undef; open(FH,'<',"test.txt") || die "oops: $!"; my @data = ; close (FH); print $data[0];