How to read a line into an array using perl -


i using perl first time. trying read line input file , store in array. note the input file contains single line bunch of words.

i tried using following code:

open input, "query"; @context = <input>; 

but gives syntax error. how fix this?

it doesn't give syntax error. works fine if there's 1 line. following first line if there more one:

my @context = scalar( <input> ); 

but why wouldn't do

my $context = <input>; 

Comments