Discussion Locked

Search list data with Grep

0 helpful
1 reply
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
Searching lists to select elements based on a specific criterion is a fairly common task--will Grep make that task easier? What do you think? Tell us about your experience with this function.

1 reply

by ivo

TIMTOWTDI(There Is More Than One Way To Do It).
In fact in Perl alway there is more than one way. Like
@a = grep {/smth/} @a - will give you all that have smth.
@a = map {$_ if /smth/} @a - is doing just the same.
And this can be done with for,foreach statement for(@a){},foraech(@a){}.
This is the BEAUTY of Perl;-)))

This discussion is closed to new replies.