my @statusoption = ('Waiting Approval' , 'Denied' , 'Approved' , 'Orde +rred' , 'Building' , 'Built' , 'Shipped'); my $status = 'Approved'; my ($position, $flag); my @popped = grep{ $flag and $_ or $_ eq $status and $flag++ or $position++, 0 }@statusoption; print "position:$position new: @popped$/" __END__ position:3 new: Orderred Building Built Shipped
In reply to Re: Grep question
by sh1tn
in thread Grep question
by hok_si_la
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |