in reply to Re: from txt file to array
in thread from txt file to array
And with saving it to an array is easy too:
my @myarray; while (<DATA>) { chomp; push @myarray, $_; }
(As you probably know, or that perldoc perlvar will tell you, $_ is a predefined Perl variable that implicitly refers to the most-recently entered source line and that is often used in situations like this for purposes of brevity.)
(Personally, I prefer to write code "pedantically," like this, because it is easy to understand and to modify later.)
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: from txt file to array
by stevieb (Canon) on Jun 21, 2017 at 23:48 UTC | |
by locked_user sundialsvc4 (Abbot) on Jun 23, 2017 at 01:21 UTC | |
by stevieb (Canon) on Jun 23, 2017 at 02:45 UTC | |
|
Re^3: from txt file to array
by morgon (Priest) on Jun 21, 2017 at 23:11 UTC | |
by karlgoethebier (Abbot) on Jun 22, 2017 at 08:36 UTC |