open my $fd, '<', $file or die "Can't open file: $!"; while(my $line = <$fd>){ # do stuff with line in $line }