Chris Stinemetz wrote:
Why does this short program only seem to capture the last line of
input in the @array, but when I put the for loop inside the while loop
all lines of input are available in @array.
I thought by declaring the @array outside the while loop would make
all of its contents avai
On 12-06-05 08:31 PM, Steve Bertrand wrote:
On 05/06/2012 3:49 PM, Shawn H Corey wrote:
On 12-06-05 05:43 PM, Bill Stephenson wrote:
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
On 05/06/2012 6:31 PM, Steve Bertrand wrote:
On 05/06/2012 3:49 PM, Shawn H Corey wrote:
On 12-06-05 05:43 PM, Bill Stephenson wrote:
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
On 05/06/2012 3:49 PM, Shawn H Corey wrote:
On 12-06-05 05:43 PM, Bill Stephenson wrote:
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
push @array, [ split /\s+/, $line, -1 ];
I
On 12-06-05 05:43 PM, Bill Stephenson wrote:
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
push @array, [ split /\s+/, $line, -1 ];
}
for my $item ( @array ) {
print $i
Maybe this is what you need?
#!/usr/bin/perl
use warnings;
use strict;
my @array;
while ( my $line = ) {
chomp $line;
push (@array = split(/\s+/, $line,-1));
}
for my $item ( @array ) {
print $item,"\n";
}
Kindest Regards,
Bill Stephenson
On Jun 5, 2012, at 4:15 PM, Chris Stinemetz wr
On Tue, Jun 5, 2012 at 4:15 PM, Chris Stinemetz wrote:
> Why does this short program only seem to capture the last line of
> input in the @array, but when I put the for loop inside the while loop
> all lines of input are available in @array.
>
> while ( my $line = ) {
> chomp $line;
> @array
Why does this short program only seem to capture the last line of
input in the @array, but when I put the for loop inside the while loop
all lines of input are available in @array.
I thought by declaring the @array outside the while loop would make
all of its contents available once all the lines