PERL BEGINNERS 7 RE LIST UTIL ARRAYS
Date: Tue, 5 Aug 2003 22:57:02 -0400 (EDT)

Subject: Re: List::Util / arrays
From: japhy@no-spam (Jeff 'Japhy' Pinyan)

On Aug 5, Jakob Kofoed said:

>1 5001
>2 5002
>3 5003
[snip]

Are those line numbers actually in the file too? If so, that might cause problems for you.

>open IN, "<", "num2.txt";
>my @no-spam = <IN>;

At this point, @no-spam holds all the lines of the file...

>push @no-spam $in[0];

... but here, you only store the FIRST line (the first element of @no-spam in the @no-spam array.

Other people have suggested better approaches; I'm just pointing out the flaw in your program.

-- Jeff "japhy" Pinyan japhy@no-spam http://www.pobox.com/~japhy/
RPI Acacia brother #734 http://www.perlmonks.org/ http://www.cpan.org/
<stu> what does y/// stand for? <tenderpuss> why, yansliterate of course.
[ I'm looking for programming work. If you like my work, let me know. ]