open FILE, $filename or die "$0: cannot open $filename for input: $!\n"; # two notes # 1. Put as much information as possible in the die string # as you can lay your hands on. # 2. That's \n, not /n, but I guess you realised that already... while( ) { # possibly... chomp; # otherwise do what you want with $_ } close FILE;