How could i assign a specific array value into $skip? I would start to read from a.txt or b.txt from a specific line (88 for a.txt and 64 for b.txt)
#!/usr/bin/perl
# Libraries
use strict;
use warnings;
# Main script
my @filename = ('a.txt', 'b.txt');
my @nrows = ('88', '64');
foreach my $file_input(glob("*.txt")) {
open my $fh, '<', $file_input or die "can't read open $IN_FILE";
for my $i (0 .. $#nrows) {
if ( $file_input eq $filename[$i] ) {
my $skip = $nrows[$i];
}
}
$/ = "\n\n"; # record separator
while( <$fh> ) {
next unless '$skip' .. undef;
my @lines = split /\n\n/;
**... some manipulations ...**
}
close ($fh);
}
I Receive following error:
Use of uninitialized value $skip in concatenation (.) or string at ./exercise.n24.pl line 14, <$fh> chunk 11.
I've made a lot of test in last 4 hours, and I don't understand where I'm wrong
$skipwill start at the 88th 'paragraph', not the 88th line.@linesshould probably be split into withmy @lines = split /\n/(only 1 newline).