I have an issue with file reading in perl
.
There is a following source:
use strict;
use warnings;
sub main()
{
my @lines = file_read("test.c") or die;
file_print(@lines);
}
sub file_read
{
my $filename = shift;
my @lines;
open(FILE, "<", $filename) or die $!;
@lines = <FILE>;
return @lines;
}
sub file_print
{
my @lines = shift();
print("Total lines " . scalar(@lines) . "\n");
foreach my $line (@lines)
{
print($line);
}
}
And the following file:
/******************************************************************************
* *
* *
The output is:
Total lines 1
/******************************************************************************
What is wrong here?
The only thing that I can suppose that it reads file till 0x0A 0x0A
ASCII
symbols combination.