##
my $filename = "/path/to/my/inputfile.txt";
my $filehandle;
if (not open $filehandle, '<', $filename)
{
print "ERROR: Could not open file $filename\n";
return 0;
}
while (my $line = $filehandle)
{
chomp($line);
# lots of stuff goes here!!!
}