in reply to seek /tell changing input delimiter
open(FILE2,"<$file2name") or die "cant open $file2name for reading!\n" +; while ($A = <FILE1>) ($tmp,$pos)= split /\s+/, $A; local($/) = ""; while (<FILE2>){ @lines = split(/\n/,$_); ($posB,$posend) = findpos(@lines); next if $posA < $posB; last if $posA > $posB + $posend; processPara(@lines) } } }
Well, that's assuming the tell isn't really outside the while as it was in your code. And you never set $posA.
With those errors fixed, with the scoping errors fixed, with strict and warnings not disabled, with a better error message for open, and with proper indenting, we get:
use strict; use warnings; open(my $fh2, '<', $file2name) or die("Can't open $file2name for reading: $!\n"); while (<$fh1>) my (undef, $posA) = split(/\s+/); local $/ = ""; while (<$fh2>){ my @lines = split(/\n/); my ($posB, $posend) = findpos(@lines); next if $posA < $posB; last if $posA > $posB + $posend; processPara(@lines); } }
|
|---|