Kevin Barry wrote:
>
> 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?
perldoc -f push
> #!/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;
push @tempwords, /\b\w{3,}\b/g;
> print @tempwords, "\n";
>
> print $tempwords[2];
> }
John
--
use Perl;
program
fulfillment
|