in reply to Using imported .txt file with Algorithms::Combinatorics
open (my $filehandle, "<", "text.txt") or die "Problem opening text.tx +t: $!"; @test = <$filehandle>; close $filehandle; chomp @test;
should do, if every line has exactly one entry.
Untested ...
see open for more examples and perlintro#Files-and-I/O¹ for general pointers to even more documentation.
Do you need suggestions for good Perl books?
Cheers Rolf
( addicted to the Perl Programming Language)
¹) strange that perlintro doesn't mention chomp
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using imported .txt file with Algorithms::Combinatorics
by TJCooper (Beadle) on Jan 08, 2014 at 12:40 UTC | |
by LanX (Saint) on Jan 08, 2014 at 12:48 UTC | |
by TJCooper (Beadle) on Jan 08, 2014 at 13:01 UTC | |
by tangent (Parson) on Jan 08, 2014 at 13:16 UTC | |
by choroba (Cardinal) on Jan 08, 2014 at 13:28 UTC | |
|