On Jun 21, Chuck Ivy said:
>Now, looking up the substring function, it looks like if the original
>string were less than the size of my substring, it would pad my variable
>until it was 4096 characters.
>
>Would a regex be better? Matching for up to 4096 characters and
>replacing the string with $1?
This is NOT the place to use a regex. Just use the substr() function to
remove all characters after the 4096th.
substr($entry, 4096) = "" if length($entry) > 4096;
or
$entry = substr($entry, 0, 4096);
>I recall some programming languages treat strings as arrays of
>characters. Is there a quick perl function or variable that represents
>the length of a string? I didn't see any obvious entries in the index of
>Programming Perl, but I may have been looking in the wrong place.
Perl's strings can't be manipulated as arrays at the high-end level
(that's not to say they're not implemented as char* in the source code).
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
I am Marillion, the wielder of Ringril, known as Hesinaur, the Winter-Sun.
Are you a Monk? http://www.perlmonks.com/ http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc. http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter. Brother #734
** Manning Publications, Co, is publishing my Perl Regex book **