Is there a preferred approach for copying an entire file into a string
variable, while preserving the record delimiters (the newline
character)?

I have found two examples; is either of them a good approach?

    open (FILE,$filename) || die "Cannot open '$filename': $!";
    undef $/;
    my $file_as_string = <FILE>;


    open (FILE,$filename) || die "Cannot open '$filename': $!";
    my $file_as_string = join '', <FILE>;
_______________________________________________
Houston mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/houston
Website: http://houston.pm.org/

Reply via email to