in reply to Re: What am I missing?
in thread What am I missing?

This part:

foreach $i (@f) { @e = grep {$_ % $i != 0} @n; @n = (); @n = @e; }

could be shortened as:

@n = grep {$_ % $i != 0} @n foreach $i (@f);

No it cannot because the statement modifier foreach does not support the syntax foreach $i (@f), it only works as foreach @f with $_ as the current element.