Thanks to all who replied. I figured reading (and writing) one byte
at a time was the bottleneck, but mostly I'm not familiar with perl's
buffer handling functions/methods... I just knew enough to compare one
byte at a time at least (and I guess even that wasn't optimal since I
was using "eq" inst
Rob Dixon wrote:
John W. Krahn wrote:
In perl you almost *never* need to use the eof() function. That is
usually written as:
while ( read IN, $buffer, $blksize )
{
But even that doesn't report any errors that read() may encounter.
while ( my $read = read IN, $buffer, $blksize )
{
John W. Krahn wrote:
In perl you almost *never* need to use the eof() function. That is
usually written as:
while ( read IN, $buffer, $blksize )
{
But even that doesn't report any errors that read() may encounter.
while ( my $read = read IN, $buffer, $blksize )
{
defined $read
[EMAIL PROTECTED] wrote:
I'm a C/C++ programmer, with a perl script I'm trying to optimize. I
don't know enough about perl syntax and string/buffer handling
functions to feel comfortable doing this on my own.
Perl's open()/read() functions are equivalent to C's fopen()/fread() and so
the IO i
[EMAIL PROTECTED] wrote:
$hostname is set to whatever I need to inject by some code above this
part, and $search is the data I need to replace with $hostname (they
are always the same length, so it never changes the size of the
downloaded file). The loop at the end is what I imagine needs to be
I'm a C/C++ programmer, with a perl script I'm trying to optimize. I
don't know enough about perl syntax and string/buffer handling
functions to feel comfortable doing this on my own. I imagine adding
some 'regular expressions' would be ideal, in place of my while()
loop. If anyone wouldn't mind