At 04:53 PM 6/22/99 -0700, Randal L. Schwartz wrote: >>>>>> "Peter" == Peter Scott <Peter@PSDT.com> writes: > >Peter> foreach my $mod (map { /(.*)\.pm$/; $1 } grep /\.pm$/, sort readdir DIR) > >Ugh. That map-grep smells. How about: > >for my $mod (sort map { /(.*)\.pm$/ ? $1 : () } readdir DIR) Ah. It was a casualty of my linear thinking... "First I need to get just the .pm's... that would be a grep... Now I want to get just the first component... that would be a map on a regex..." But the repetition of the \.pm is a dead giveaway that a better approach is available, yes... >Peter> eval "require \"$file\""; >Peter> die "Couldn't load $file: $@\n" if $@; > >Uh, if you can't load $file, let the require fail! > > require $file; Um, the die was a placeholder for more fault-tolerant processing to follow... Peter Scott Pacific Systems Design Technologies ==== Want to unsubscribe from Fun With Perl? ==== Well, if you insist... Send mail with body "unsubscribe" to ==== fwp-request@technofile.org