There's more than one way to do things | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
True, of course, but in my opinion using the dereference operator -> explicitely anyway makes it clearer what your intentions are. $thingy{foo}[3] might work when %thingy is your root hash, so to speak. But once you're deeper into the structure, where you've loaded stuff into variables such as $thingies_a_thingy_does_in_the_weekends which would be an arrayref or hashref, you're either bound to use -> or dereference the whole thing anyway. That, and there's nothing wrong with littering your code with ->. Sometimes being explicit makes things all the more readable. For example, let's assume a function superFunc, that returns different things based on whether its called in scalar context or list context. In my $superScalar = scalar(superFunc) it's already clear that you want the scalar context behaviour from the my $superScalar part. But by calling it as scalar(superFunc) you say: "yes, I know that superFunc is context sensitive and yes, I really want its scalar context behaviour." But I digress. In reply to Re^3: Access Hashes of Hashes etc.
by muba
|
|