use IO::Handle; open (my $fh, '<', $FILE) or die $!; # then simply call method from IO::Handle $fh->getline();