Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Sequential defined-or operators

by naikonta (Curate)
on Jan 14, 2008 at 06:01 UTC ( #662262=perlquestion: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download

  1. or download this
    my $default = 0;
    my $input_number = $ARGV[0];
    my $number = defined $input_number ? $input_number : $default;
  2. or download this
    my $number = $input_number // $default;
  3. or download this
    my $default_theme = get_default_theme();
    my $global_config = read_config('/path/to/config_file');
                        $default_theme                                :
  4. or download this
    my $theme = $global_config->{modes}{$current_mode}{theme} //
                $theme_config->{current_theme} //
                $default_theme //
  5. or download this
    my $theme = (

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://662262]
Approved by ikegami
Front-paged by McDarren
[choroba]: unit tests++
[choroba]: The only problem you can't solve by adding more tests is the problem of having too many tests.
[stevieb]: choroba Been there, done that :) Better too many than not enough though!
[stevieb]: I very often write a base set of unit tests before writing any code. It helps dictate the API, and ensures my earliest of ideas stay on track.

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2017-07-21 20:05 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (335 votes). Check out past polls.