Perl doesn't have structs as C does, unless you're using the Class::Struct module from CPAN. So your question seems to be meaningless.
In PERL when declaring a struct, do you need to setup default values for each variable in the structure?
you mean a hash, not a struct?
in this case, you don't need to setup default values. Perl never needs default values.
Reply:You're the guy who keeps calling hashes "structs", right?
The simple answer is "no". In fact you don't need to pre-declare any part of the structure of a hash in Perl.
You don't need to declare explicit default values, but you have to know that Perl's default value is undef, and you have to properly handle the undef value in your program.
birthday cards
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment