Jim Correia wrote: > > On 12:25 PM 12/27/00 Dan Baker <dan@dtbakerprojects.com> wrote: > > > Jim Correia wrote: > > > What is the best (fastest, clearest code) to read an entire file > into a > > > variable? > > ----------- > > > > open( HANDLE , "<$RelativeFilePath" ) or die "failed to open > > $RelativeFilePath because $!"; > > @WholeFile = (<HANDLE>); > > This is specifially what I was trying to avoid. I wanted a scaler so > why pay for the overhead of conversion to a list then back again. And > then there is the issue of non-native line endings... ----------------- the overhead really isnt that bad... its fast. depending on what you are trying to do with the text, you usually end up looping thru line by line anyway. You may not NEED to turn it into a scalar to process... it is possible to use modifiers in regx expressions to work across line breaks if that is what you need to do; no need for a loop if your logic can be handled in a regx. if you want to get rid of the line endings, you can use the chomp() in a loop thru @WholeFile if you really want to turn it into a scalar, then just do a $BigString = join ( '', @WholeFile ); Dan # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org