>>>>> "David" == David Gray <[EMAIL PROTECTED]> writes:
David> When you have David> LIST2 = map { m!^(.*)/\*$! } LIST1 David> It's shorthand for a loop like: David> foreach my $el (@LIST1) { David> if($el =~ m!^(.*?)/\*$!) { David> push @LIST2,$1 David> } else { David> push @LIST2,() David> } David> } Not really. Don't muddle that up with an extra 'if', or you'll be implying some Extra Magick in the map operator. The map operator is dumb as rocks. It just takes the last expr evaluated *in a list context* and appends it to the end of the result list. If anything, the "smooth operator" here is the regex match in a list context! So it's closer to this: @LIST2 = (); foreach (@LIST1) { my @result = m!^(.*?)/\*$!; ## at this point, @result is either $1 for a match, or () for a non match push @LIST2, @result; ## and thus we've either pushed $1 (single element) or empty list (nothing) } David> So when the regular expression doesn't match, it pushes an empty list, David> which adds nothing to the array. Yes, but not by the mechanism you're illustrating. -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]