# (Prematurely?) declare lexical variable 405 my $fh; # Get file name from the $file object. 406 my $txtfile = $file->fileName();
# Open file using lexical variable # declared earlier for file handle. # Do not test file opening for success. 407 open $fh, $txtfile; # Declare lexical variable and initialize # it to an empty string. 408 my $plain_text = ''; # Concatenate new string to $plain_text # for each line in the file associated # with $fh. 409 $plain_text .= $_ foreach (<$fh>); close $fh; IMO, a more correct sequence might look like this (assuming we no longer need $fh). my $plain_text = do { my $file = $file->fileName(); open my $fh, '<', $file or die qq(Cannot open "$file": $!); local undef $/; <$fh>; }; Read perlfaq5 'How can I read in an entire file all at once?' for other details and answers. Read perlvar for details on '$/'. Read perlop for details on '.='. HTH, Charles K. Clarkson -- Mobile Homes Specialist 254 968-8328 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>