in reply to simple array condition

You could put grep() to good use in this situation e.g
if(grep { defined and $_ ne "" } @array[9..13]) { &mysub(); ... } # or using your second example @array = qw(name address age date1 date2 date3 date4 date5); &your_function_here($_) for grep /date\d+/, @array;

HTH

broquaint

Replies are listed 'Best First'.
Re: Re: simple array condition
by Anonymous Monk on Apr 03, 2002 at 23:53 UTC
    Broquaint actually answered your questions as asked. Given the additional information that that wasn't really what you wanted, I am speculating you want to run your sub once for each of the elements in that range which is defined and non-null, for which an obvious implementation would be:
    &mysub() for (grep { defined and $_ ne "" } @array[9..13]);