Essentially, i'm trying to take the values in an array, split them on white space, append a newline, and then store it all in another array
I'd do it like this:
my @file = ("eddie van halen", "david lee roth", "alex van halen", "mi +chael anthony"); my @stuff = map { "$_\n"; } map { split /\s+/, $_; } @file; print @stuff;
edit: doh! dragon beat me to it (that's what I get for not reading responses first), but ah well at least I arrived at the exact same solution (I'm just overly explicit -- call it paranoia) so I guess it proves we are likely equally insane or something like that :)
If you want to remove things from that group, you use grepNot just that, but for those that don't know grep, it's also very nice for searching and counting! Essentially you are counting by removing all of the "non-hits" and then checking the scalar value of the array result, aka cardinality of the set. R0XX0R! (err, sorry, 1337 speak outbreak...)
In reply to Re: using map and anonymous subroutines
by flyingmoose
in thread using map and anonymous subroutines
by ritontor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |