in reply to Contents of a file into a scalar
MarkofPerl: I'm aware of the "or die!" stuff, I'm just debugging right now ...davido: Debugging time is the most important time to have error reporting in place.
Yea and amen, brothers and sisters in Perl! Ignore these wise words at the peril of your sanity.
Update:
... if i put these two pieces of code together, is the read pointer already at the end of the file, and that's why they won't work in succession?I don't know how File::Slurp works (maybe read the docs), but if an ordinary file handle is used to read a file all the way to the end, the file is 'exhausted' and any further built-in read operations will return nothing. See seek to re-position the logical file pointer to the beginning of the file (or anywhere else in the file).
|
|---|