in reply to Re: Hope a subroutine will return undef by default
in thread Hope a subroutine will return undef by default

Before you made the update, I prepared a short demonstration of the difference:
#!/usr/bin/perl use warnings; use strict; use Data::Dumper; sub explicit { return undef } sub bare { return } print "Explicit: ", Dumper [ explicit() ]; print "Bare: ", Dumper [ bare() ];

Output:

Explicit: $VAR1 = [ undef ]; Bare: $VAR1 = [];
لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^3: Hope a subroutine will return undef by default
by boftx (Deacon) on Feb 11, 2014 at 16:55 UTC

    Good demo! I didn't see it when adding the update. :( On the other hand, it's hard to have too many examples/discussions on how context can come into play in unexpected ways.

    It helps to remember that the primary goal is to drain the swamp even when you are hip-deep in alligators.