- or download this
sub do_nothing {
...
# return 'nothing'
return ();
}
- or download this
wantarray ? : ;
- or download this
#!/usr/bin/perl -w
...
sub zero {
return 0;
}
- or download this
scalar context _undef == $VAR1 = undef;
...
scalar context nothing == $VAR1 = undef;
list context nothing == $VAR1 = [];
- or download this
sub routine {
return undef;
}
- or download this
sub routine {
return 0;
}
- or download this
#!/usr/bin/perl -w
...
sub zero {
return 0;
}
- or download this
Benchmark: timing 10000000 iterations of _undef, empty, nothing, zero.
+..
_undef: 2 wallclock secs ( 0.89 usr + -0.01 sys = 0.88 CPU) @ 11
+363636.36/s (n=10000000)
empty: 2 wallclock secs ( 1.09 usr + 0.00 sys = 1.09 CPU) @ 91
+74311.93/s (n=10000000)
nothing: 0 wallclock secs ( 0.50 usr + 0.00 sys = 0.50 CPU) @ 20
+000000.00/s (n=10000000)
zero: 0 wallclock secs ( 0.06 usr + 0.00 sys = 0.06 CPU) @ 16
+6666666.67/s (n=10000000)
- or download this
sub build_list {
my ($arg1, arg2, ...) = @_;
...
return ();
}
}