in reply to put file content into a string

Well, my dear monks, the reason I thought this might work is because of this
open IN,"<myFile" or die "Hmmm Error" ; @str = <IN> ; close IN ;

Thanks
Luca

Replies are listed 'Best First'.
Re^2: put file content into a string
by Fletch (Bishop) on Dec 19, 2005 at 16:26 UTC

    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.