I can understand everyone saying that what you are saying doesn't make sense.
I just wanted to drop a quick note saying there actually are cases where you can't open a huge file from within Perl but where you can do: cat huge.file | perlscript It is a strange concequence of how "large file support" was retrofitted into some operating system(s). In order to open a really large file under these operating systems you have to use a special version of open() that Perl will only use if you've compiled Perl to include "large file support". The operating system prevents you from opening the file otherwise just in case you plan on using seek() on the file handle.
In some ways I think this is a pretty silly decision, but then I haven't analyzed the situation much and yet I can still understand at least the temptation to do this so it is probably a reasonable design that just looks stupid until you understand the trade-offs better.
In any case, such operating system(s) will have a program called 'cat' that knows how to open and read such huge files so you just need to use: open( FILE, "cat $filename |" ) or die... and make very sure that $filename doesn't contain "interesting" characters. I'd show the secure way to do that, but I don't think there is one simple answer that covers all of the variables (versions of Perl, versions of operatings systems, etc.). I guess, since we are assuming 'cat', we can also assume /bin/sh and so
is probably bullet-proof. - tye (echo "but my friends call me "'"'"$Tye"'"')open( FILE, qq<cat "\Q$filename\E" |> ) or die ...;
P.S. Please, please, please! Register a username at the site. It will make it easier for us to help you when you have these problems figuring out why you think your question has disappeared and will make it easier for you to find your questions and their answers.
Failing that, please, please, please, don't keep posting the same question over and over! You need to have a little patience. When you post a question, it doesn't appear on the main pages of the web site right away. That does not mean that your question has been lost and it doesn't even mean that there aren't people already reading your question and writing answers to it.
In reply to (tye)Re: get the line of ith occurrence of '>' without OPENING THE FILE
by tye
in thread get the line of ith occurrence of '>' without OPENING THE FILE
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |