Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
In my below code snippet ,the array @header_present is always true,the value pushed into it gets stuck here,I am clearing the data at the start of the loop again but still the array condition some how is always true.Can some one advise what is wrong?
my @headers; my @header_present=" "; #clearing the data here if ($line =~ /.\data/) { push @header_present,grep( (/\Q$line\E/i), @headers); if(@header_present)#this is always true,the value pushed + above gets stuck,how to clear the array when it executes next time? { }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Array condition always true
by moritz (Cardinal) on Mar 20, 2011 at 09:42 UTC | |
by Anonymous Monk on Mar 20, 2011 at 11:36 UTC | |
by GrandFather (Saint) on Mar 20, 2011 at 19:42 UTC | |
|
Re: Array condition always true
by GrandFather (Saint) on Mar 20, 2011 at 09:11 UTC | |
by Anonymous Monk on Mar 20, 2011 at 09:56 UTC |