Perl - How to read file line by line ?

Description: 

How to open file using Perl script and read it line by line ?

Comments

Michael (not verified)

Here You have some example, if You dont understand how its working, just ask and I will explain You.

use strict;
use warnings;

my $file = '/path/to/your_text_file.txt';
open my $filehandle, $file or die "Could not open $file: $!";

while( my $line = <$filehandle>) {
print $line;
last if $. == 2;
}

close $info;

Add new comment

CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Fill in the blank.