You got bitten by yet another facet of Perl which is sensitive to the calling context. In LIST context the diamond operator (<FH>) does indeed return a list of all the lines in the file (separated by the current value of $/). However in SCALAR context it just returns the next line (again, separated by $/). This mjd USENET posting may clear things up if you're still fuzzy. If you ever see "strange" behavior like this check the docs and make sure it's not context sensitive.
In reply to Re^2: put file content into a string
by Fletch
in thread put file content into a string
by jeanluca
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |