maheshkumar has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to put each line of a text file in an array, but encountering some problem with the logic. Can any one tell if the following logic is correct?
use warnings; @ARGV = 'Google_1'; my @results; while ( <ARGV> ){ chomp $_; if($_ =~m/head/){ push (@results, $_); } } print "@results\n";
or can we use hash with these? My text file looks something like this but it has around 40k lines
192.168.178.1 82.135.16.28 212.18.7.101 212.18.6.166 80.81.192.28 92.123.72.112 82.135.16.28 212.18.7.101 212.18.6.77 217.71.108.93 217.71.96.169 194.59.190.3 134.222.231.49 134.222.229.49 134.222.229.205 134.222.229.222 134.222.231.22 62.41.85.112
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Putting files in an Array
by toolic (Bishop) on Jul 11, 2012 at 15:18 UTC | |
Re: Putting files in an Array
by blue_cowdawg (Monsignor) on Jul 11, 2012 at 15:20 UTC | |
Re: Putting files in an Array
by kcott (Archbishop) on Jul 11, 2012 at 15:39 UTC | |
Re: Putting files in an Array
by cheekuperl (Monk) on Jul 11, 2012 at 15:17 UTC | |
by monsoon (Pilgrim) on Jul 11, 2012 at 15:27 UTC | |
Re: Putting files in an Array
by jethro (Monsignor) on Jul 11, 2012 at 15:26 UTC | |
by monsoon (Pilgrim) on Jul 11, 2012 at 15:31 UTC | |
by zentara (Archbishop) on Jul 11, 2012 at 17:57 UTC | |
Re: Putting files in an Array
by zentara (Archbishop) on Jul 11, 2012 at 18:02 UTC | |
Re: Putting files in an Array
by Kenosis (Priest) on Jul 11, 2012 at 15:48 UTC |
Back to
Seekers of Perl Wisdom