RE: [perl #40345] splice question

2006-09-20 Thread Thomas Bätzler
Derek B. Smith <[EMAIL PROTECTED]> asked: > >If you really need to do this in place due to memory constraints, I > >would advise to run the iteration from back to front, i.e. > And why would this be? Becasue it does not load the entire > data set at once or aka one at a time? grep creates a n

RE: [perl #40345] splice question

2006-09-19 Thread Derek B. Smith
And why would this be? Becasue it does not load the entire data set at once or aka one at a time? >If you really need to do this in place due to memory >constraints, I >would advise to run the iteration from back to front, >i.e. >foreach my $indx (reverse 0..$#$ref_array) __

Re: [perl #40345] splice question

2006-09-19 Thread John W. Krahn
Thomas Bätzler wrote: > > One possibility that would work is to use > > $ref_array = [ grep /^.+$/, @$ref_array ]; It would be more efficient to use the regex /./s or the length function. Your regex has to match ALL the characters. (And it won't match if there are multiple lines in the string.

Re: [perl #40345] splice question

2006-09-19 Thread John W. Krahn
Tova Yaron wrote: > Hello, Hello, > Trying to remove from array blank lines, its look like splice get > confuse with the array size after removing the blank entry. > Or maybe I'm getting confuse.. > > > use strict; > > my ($str0, $str1, $str2, $str3, $str4, $str5, $str6, $str7, $str

Re: [perl #40345] splice question

2006-09-19 Thread Dr.Ruud
"Tova Yaron" schreef: > Trying to remove from array blank lines, its look like splice get > confuse with the array size after removing the blank entry. > Or maybe I'm getting confuse.. When an element is removed, your loop-variable is no longer in sync. Consider grep: #!/usr/bin/perl use w

RE: [perl #40345] splice question

2006-09-19 Thread Thomas Bätzler
Tova Yaron <[EMAIL PROTECTED]> wrote: > Trying to remove from array blank lines, its look like > splice get confuse with the array size after removing the > blank entry. Or maybe I'm getting confuse.. > my ($str0, $str1, $str2, $str3, $str4, $str5, $str6, $str7, $str8, > $str9,) >

[perl #40345] splice question

2006-09-19 Thread Tova Yaron
Hello, Trying to remove from array blank lines, its look like splice get confuse with the array size after removing the blank entry. Or maybe I'm getting confuse.. Thanks Dov use strict; my ($str0, $str1, $str2, $str3, $str4, $str5, $str6, $str7, $str8, $str9,) =