Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Sequential defined-or operators

by ikegami (Pope)
on Jan 15, 2008 at 03:28 UTC ( #662416=note: print w/replies, xml ) Need Help??


in reply to Re^2: Sequential defined-or operators
in thread Sequential defined-or operators

It took me a second to understand that you are referring to the short-circuiting nature of //. If you needed the short-circuiting behaviour pre-5.10, here's one solution:
sub first(&@) { my $cb = shift(@_); for (@_) { my $i = ref eq 'CODE' ? $_->() : $$_; my $rv; $rv = $cb->() for $i; return $i if $rv; } return; } my $theme = first { defined } \$global_config->{modes}{$current_mode}{theme}, \$theme_config->{current_theme}, \&ask_user, \'none';

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://662416]
help
Chatterbox?
[Discipulus]: it seems..
[Discipulus]: more: just one thread in the last ~5 years
[Discipulus]: but Dumas is waiting for me in the bed.. luckly as book author.. see you!
[ELISHEVA]: Sleep well!
[ELISHEVA]: Or read well
[Discipulus]: thanks, best dreams to you all

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (9)
As of 2017-05-28 20:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?