in reply to How to read from a file instead from a hard coding list.
my @words=qw( portion answers printer program );
To:
my $file = '/path/to/file'; my @words; open my $fh, '<', $file or die "Could not open $file: $!"; while(<$fh>){ push @words, split; } close $fh or die $!;
Untested.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to read from a file instead from a hard coding list.
by 300zxmuro (Initiate) on Apr 26, 2012 at 02:54 UTC |