[pm-h] reading a file as a string

Russell L. Harris rlharris at oplink.net
Sat May 19 22:43:39 PDT 2007


* Andy Lester <andy at petdance.com> [070519 21:35]:
> Do it this way:
> 
> my $file_as_string = do {
>      open( my $fh, $filename ) or die "Can't open $filename: $!";
>      local $/ = undef;
>      <$fh>;
> };


Andy,

I am confused by the use of "my $fh" in the open command.  By what
mechanism is $fd assigned a value?

RLH


More information about the Houston mailing list