in reply to Re: Beginner in perl : Use of uninitialized value
in thread Beginner in perl : Use of uninitialized value
Just another tip: there is no need to read all of STDIN into an array; you can iterate over each line as it comes in.foreach my $line (<STDIN>) { ... }
The problem with that is that the foreach loop will read all lines into a list in memory first.
You need a while loop to iterate over one line at a time:
while ( my $line = <STDIN> ) { ... }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Beginner in perl : Use of uninitialized value
by jimpudar (Pilgrim) on Dec 28, 2018 at 20:20 UTC | |
by Perl_Programmer1992 (Sexton) on Dec 29, 2018 at 07:42 UTC |