Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Hope a subroutine will return undef by default

by choroba (Abbot)
on Feb 11, 2014 at 16:50 UTC ( #1074446=note: print w/ replies, xml ) Need Help??


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 = [];
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ


Comment on Re^2: Hope a subroutine will return undef by default
Select or Download Code
Re^3: Hope a subroutine will return undef by default
by boftx (Chaplain) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1074446]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (14)
As of 2014-10-23 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (129 votes), past polls