gam3 has asked for the wisdom of the Perl Monks concerning the following question:
subroutine 'a' returns a list, where subroutine 'b' returns a hash reference. It seems to me that they should both return a hash reference. I noticed this behavior when I had code that stated out assub x { ('a', 'b', 'c', 'd'); } sub a { { x }; } sub b { $x = { c }; } sub c { { 'a', 'b', 'c', 'd' }; } sub d { { ('a', 'b', 'c', 'd') }; } print a, "\n"; print b, "\n"; print c, "\n"; print d, "\n";
and then removed the a => 'b'. This caused code to break as the sub routine started returning a list instead of a hash reference.{ a => 'b', c(), }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: When in a hashreference a subexpresion?
by GrandFather (Saint) on Aug 09, 2006 at 02:31 UTC | |
|
Re: When in a hashreference a subexpresion?
by rodion (Chaplain) on Aug 09, 2006 at 02:15 UTC | |
|
Re: When in a hashreference a subexpresion?
by gcalexander (Novice) on Aug 09, 2006 at 04:12 UTC | |
by Anonymous Monk on Aug 09, 2006 at 08:13 UTC | |
by Jasper (Chaplain) on Aug 09, 2006 at 14:53 UTC |