How can I use __DATA__ twice?

To use the DATA filehandle twice you need to rewind it. The tricky bit is that if you do seek(DATA, 0, 0), it’ll be positioned to the first source line, not the line after __DATA__. Therefore you need to save the position first: my $data_start = tell DATA; # save the position print while (<DATA>); … Read more

Does reading an entire file leave the file handle open?

The answer to that question depends somewhat on the particular Python implementation. To understand what this is all about, pay particular attention to the actual file object. In your code, that object is mentioned only once, in an expression, and becomes inaccessible immediately after the read() call returns. This means that the file object is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)