There is a length() function.
eg. $string = 'my little little string';
$lengthOfstring = length($string);
if ( $lengthOfstring >= 4096 blah ) {
blah
}
----- Original Message -----
From: "Chuck Ivy" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 21, 2001 2:31 PM
Subject: Limiting String Length
> I've got a simple message board script that I cobbled together. It seems
> to have been the target of some abuse, though.
>
> The latest patch I'd like to apply to the code would be limiting the
> length of a message posted to, say, 4096 characters.
>
> 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?
>
> 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.
>
> Or is this a good place for formatting commands?
>
> Any suggestions welcome.
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com