I'm not saying that this is any better or worse than what has already been posted, but you might wish to check out the
File::Slurp, which already does what you are trying to do. It's as simple as:
use File::Slurp;
@array = read_file($filename);
HTH!
MrCromeDome