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
hahah, sure, why dont we do this then:
my $coolstring;
my @foo = split '', $str;
for (0..4095) { $coolstring .= $foo[$_] }
or how about this one:
my $foo = reverse $str;
while (length $foo > 4096) { $foo =~ s/.(.+)/$1/seg; }
$str = reverse $foo;
and no, i wont be held accountable for any loss o
On Jun 21, Paul said:
>--- Chuck Ivy <[EMAIL PROTECTED]> wrote:
>> 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
>> Progr
On Thu, Jun 21, 2001 at 11:31:21AM -0700, Chuck Ivy wrote:
> 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.
> perl -wle 'foreach my $str(qw(foo foobarblahdoo))
--- Chuck Ivy <[EMAIL PROTECTED]> wrote:
> 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.
>
On 21 Jun 2001 14:39:47 -0400, Chas Owens wrote:
> How about
>
> use constant MAXSTRLENGTH => 4096;
>
> substr($string, MAXSTRLENGTH - 1, -1) = '' unless(length($strlen) <
> MAXSTRLENGTH);
>
Oops, let me ammend that to
use constant MAXSTRLENGTH => 4096;
substr($str, MAXSTRLENGTH - 1) unless
How about
use constant MAXSTRLENGTH => 4096;
substr($string, MAXSTRLENGTH - 1, -1) = '' unless(length($strlen) <
MAXSTRLENGTH);
On 21 Jun 2001 11:31:21 -0700, Chuck Ivy wrote:
> I've got a simple message board script that I cobbled together. It seems
> to have been the target of some abuse, th
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 wi