On Aug 6, Trina Espinoza said:
>I would like to have the data of <> as one long string. Right now I have
>@list = <> because if I do $scalar= <> it only captures one line of my
>file. However, what I really need is to capture the data as one long
>string. Can anyone deliver a swift answer for this?
The simplest way to do this is to set $/ to undef, locally. $/ defines
what Perl reads up to every time you do a <FH>. By making it undef, Perl
will read the entire file all at once.
my $str;
{
local $/; # makes $/ undef, for the remainder of this block
$str = <FH>;
}
See also the File::Slurp module.
--
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]