From: AndrewMcHorney <[EMAIL PROTECTED]>
> I am continuing work on my script. I know there are many ways to read
> files. I am going to be opening files that are text and also that are binary.
>
> Here are my 2 ways that I have done it it in the past. I am wondering
> which way is best.
>
> $_ = join '',(<SOURCE_FILE>) or @SourceLine = (<SOURCE_FILE>)
>
> Which one is the best way or is there a better solution?
If you want the whole file in one scalar, do not ask Perl to split it
into lines and join it back.
$_ = do {local $/; <SOURCE_FILE>};
(or the File::Slurp if you feel like that)
In the second case you can drop the round brackets.
@SourceLine = <SOURCE_FILE>;
but they do not make any difference.
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/