If it's a Perl string, the unhelpfully named length function (see perlfunc:length) would do the job. If it's a text file, use the -s filetest, as in
my $size = -s $filename;
Philosophy can be made out of anything. Or less -- Jerry A. Fodor | [reply] [d/l] [select] |
If it's a string or a filehandle, you can do
my $size = (stat($file))[7];
| [reply] [d/l] |
Hmmm...all files end in EOF but if you want to stop before then, let's say on a marker like 'STOP', then simply search for it while reading it in and split() appropriately.
AgentM Systems nor Nasca Enterprises nor
Bone::Easy nor Macperl is responsible for the
comments made by
AgentM. Remember, you can build any logical system with NOR.
| [reply] |
Actually, it's not at all true that all files end in EOF (as a character, at least). If I do echo test > test.txt, you'll see a 4-byte file (at least under Win32, and I'd be terribly surprised to see it different under other OS's).
| [reply] [d/l] |
Sorry, but all files are required to end in EOF in POSIXland. Why should you be surprised? Does it make sense to do otherwise? Are you sure that Windows doesn't simply ignores EOFs in its editors and byte counts?
AgentM Systems nor Nasca Enterprises nor
Bone::Easy nor Macperl is responsible for the
comments made by
AgentM. Remember, you can build any logical system with NOR.
| [reply] |
If it's a string, the unhelpfully named perlfunc:length would do the job. If it's a text file, use the -s filetest, as in
my $size = -s $filename;
UPDATE I'm going to ask to have this deleted. -- the later post accordingly =)
Philosophy can be made out of anything. Or less -- Jerry A. Fodor | [reply] [d/l] [select] |