There is no limit on the length of a scalar in Perl other than the amount of
memory you have.  It is possible that it is splitting the newline because
you are using a multi-byte character set, or the global variable $/ (input
record seperator) was changed in the script, or you are working with binary
data.  In other words I am guessing that you have the character value 10 (a
linefeed) somewhere inside of the string, and it is splitting the string on
that.

Rob

-----Original Message-----
From: Anette Seiler [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 12, 2002 4:55 AM
To: [EMAIL PROTECTED]
Subject: How long can $_ be?


Hi!

Is there some limit in how long the contents of the variable $_ can 
be? 

The problem I have is following: my script reads a file line by line. 
These lines are fairly long. As soon as I work with the long lines 
problems arise. The script chops off the first part of the line. When I 
print $_ I don't get the whole line, but only the last part .

I made several experiments. 

The first line I gave was 490 characters long, $_ contained the last 
233 characters. The string was chopped off at character 257.

The second line I gave was 462 characters long, $_ contained the 
last 205 characters. The string was chopped off at character 257.

The third line I gave was 253 characters long, $_ contained the 
whole 253 characters. Nothing was chopped off.

The fourth line I gave was 839 characters long, $_ contained the 
last 68 characters. The string was chopped off at character 771.

I encounter this problem on Solaris machines running Perl 5.005. 
On Windows with Perl 5.6.1. no such problem was encountered.

What could cause the problem?

Kind regards

Anette
Mit freundlichen Grüßen

Anette Seiler

HBZ-NRW
Geschäftsbereich Digitale Bibliothek 
Tel.: +49-221-40075-196
Fax: +49-221-40075-190
www.hbz-nrw.de

email: [EMAIL PROTECTED]

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to