in reply to Cant use array with numbers??
I would normally see this as a soluition:
This avoids the (in my mind) messy next which really isn't needed in this very small loop, and it reads well syntactically: For each element in the array, print the element unless it's a "Dont Print Me". which is only a small jump from the ideal Print each element in the array unless it's a "Don't Print Me".foreach ( @array ) { print $_ unless ( $_ eq "DontPrintMe" ); }
You already have a couple of different ways to do it in this thread -- but you could also use map in a void context; I'll leave that for you to discover (and avoid).
|
|---|