in reply to get the line of ith occurrence of '>' without OPENING THE FILE

As others have mentioned, you probably misunderstand the difference between opening a file and reading it into memory. If you simply want to read to the 10000th '>', this might work.

my $big_line = "" # Set the newline character to '>' $/ = '>'; open fh, $filename; for (my $i = 0; i < 10000; i++) { $big_line .= <fh>; } $/ = "\n"; close fh;
Now $bigline will contain everything up to the 10000th '>'. I'm not sure that this will work if you've been having file troubles, but it's probably worth a try.
  • Comment on Re: get the line of ith occurrence of '>' without OPENING THE FILE
  • Download Code