perl.beginners
  Home FAQ Contact Sign in
perl.beginners only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
perl.beginners Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  RE: How to Read Files? [was: Re: learning perl 3rd vs 4th]         


Author: T Baetzler
Date: May 25, 2008 23:30

AndrewMcHorney cox.net> asked:
> The spec does not allow for carriage returns or line feeds
> making it a long line. Is there a way to read "x" number of bytes?

$ perldoc -f read

read FILEHANDLE,SCALAR,LENGTH,OFFSET
read FILEHANDLE,SCALAR,LENGTH

Attempts to read LENGTH characters of data into variable SCALAR from the specified FILEHANDLE. Returns the number of characters actually read, 0 at end of file, or undef if there was an error (in the latter case $! is also set). SCALAR will be grown or shrunk so that the last character actually read is the last character of the scalar after the read.

[...]

HTH,
Thomas
no comments
  Include PHP file inside the Perl script         


Author: Sivasakthi
Date: May 25, 2008 21:32

Hi all,

Is it possible to include php file inside the perl script??

I need the defined php variable (from php files) inside perl script..

how can i achieve that??

Thanks,
Siva
1 Comment
  Re: How to Read Files? [was: Re: learning perl 3rd vs 4th]         


Author: Rob Dixon
Date: May 25, 2008 11:10

Hi Andrew

(If you are asking a new question of this group please make a fresh post with an
appropriate subject line rather than replying to the end of an old thread. Many
of us have email clients that correctly display the flow of threads, and using
reply makes it look as if you have something more to say about a previous topic.
Thanks.)
> I have been reading files with the following command:
>
> @source_lines = ();
>
> This has worked until I started reading some very large files.

This reads the entire file into the array, and should only be used for files
that you can guarantee to be very small. As you have found, filling up your
computer's memory isn't a good idea!
> Is there a better way to read files? The files I am trying to read now are
> about 300 megabytes in size.

In most cases you will need access to only one record at a time. Writing a loop
like this
Show full article (1.46Kb)
2 Comments
  LWP::Parallel concerns         


Author: chadda
Date: May 25, 2008 10:20

Maybe I'm wrong, but if I were to use LWP::Parallel to parse a remote
site for a few hours, then couldn't this be possibly interpreted as a
Denial of Service? And if could be interpreted as a possibly Denial of
Service attack, what could I do to possibly avoid it?
2 Comments