use strict; use warnings; open my $fh, '<', 'C:\scripts\vacuum.txt', or die "Could not open file $!"; while (my $line = <$fh>) { print "line $. reading '$line'\n"; } #update: removed nonsense part as pointed by BrowserUk below