[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [FWP] Something like "grepfirst"



Roland Bauer <roland.bauer@fff.at>, wrote:
> What is the shortest code for finding the first
> existing directory in a path of directories?


foreach (qw(dir0 dir1 /tmp)) { (-d) ? print "$_", last : next; }

But I am not sure how to get two-for-one commands...

Does anyone know?

I tried '
print "$_" && last;
but that doesn't work either.

???
-Sneex-  :]

==== Want to unsubscribe from Fun With Perl?  Well, if you insist...
==== Send email to <fwp-request@technofile.org> with message _body_
====   unsubscribe