K
Kevin Barry
I'm writing a program to parse words of three or more characters from a file
into an array. But when I load the words into the array and look to print
individual words it seems to have overwritten earlier lines with the last
line in the file. What am I missing here?
#!/usr/bin/perl
#matchtest3.pl
use warnings;
use strict;
my @tempwords;
open FD, "< dslinfo1.txt" or die $!;
while (<FD>){
@tempwords = /\b\w{3,}\b/g;
print @tempwords, "\n";
print $tempwords[2];
}
There's nothing special about the *.txt file just a notepad file with 3
lines of txt.
Kevin
into an array. But when I load the words into the array and look to print
individual words it seems to have overwritten earlier lines with the last
line in the file. What am I missing here?
#!/usr/bin/perl
#matchtest3.pl
use warnings;
use strict;
my @tempwords;
open FD, "< dslinfo1.txt" or die $!;
while (<FD>){
@tempwords = /\b\w{3,}\b/g;
print @tempwords, "\n";
print $tempwords[2];
}
There's nothing special about the *.txt file just a notepad file with 3
lines of txt.
Kevin