in reply to Re: deleting array elements(efficiency/critique)
in thread deleting array elements(efficiency/critique)

It's unclear whether or not the array can contain a valid line which consists of the empty string or the character '0'. either of these possibilities would break your code. This problem can be fixed with:

@{$mon_obj->{FILE_DATA}} = grep { defined $_ } @{$mon_obj->{FILE_DATA}};
--
<http://www.dave.org.uk>

"Perl makes the fun jobs fun
and the boring jobs bearable" - me

Replies are listed 'Best First'.
Re: Re: Re: deleting array elements(efficiency/critique)
by I0 (Priest) on Dec 27, 2000 at 21:33 UTC
    Yes, that's an obvious refinement, which the original loop did not contain,
    presumably because '' and '0' are either not present or not valid
    so I preserved that behavior in the grep condition.