On Oct 8, Rob Dixon said:
>Jeff 'Japhy' Pinyan wrote:
>>
>> open BLAH, "< c:/Inetpub/wwwroot/dg/menu.txt"
>> or die "can't read c:/Inetpub/wwwroot/dg/menu.txt: $!";
>
> my $fd;
> open $fd, '< c:/Inetpub/wwwroot/dg/menu.txt';
>
>might be a better match? With $fd in place of 'BLAH' in the
>rest of the code.
Only if he's got a version of Perl that supports that syntax.
>> >$line = fread($fd,filesize("C:\Inetpub\wwwroot\dg\menu.txt"));
>>
>> my $content = join "", <BLAH>;
>> # or
>> my $content; { local $/; $content = <BLAH>; }
>> # or
>> read(BLAH, my $content, -s BLAH);
>> # etc.
>
>I'm staying faithful to:
>
> my $content = do {local $/; <$fd>};
Last I checked, that makes TWO copies of the string from <$fd>: one in
the do BLOCK, and then it gets copied and returned to $content. I could
be wrong, but I think I heard about it on p5p.
--
Jeff "japhy" Pinyan [EMAIL PROTECTED] http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]