Recursively printing data structures in Perl

前端 未结 8 1907
粉色の甜心
粉色の甜心 2021-01-13 05:32

I am currently learning Perl. I have Perl hash that contains references to hashes and arrays. The hashes and arrays may in turn contain references to other hashes/arrays.

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-13 05:53

    My guess is that he doesn't like that you

    1. expect a hash in the str function.
    2. call the same function to print arrays as hashes, despite that there appears to be no common function between them.
    3. allow various ways to call str, but it never figures into the final result.
    4. allow configurable space to be passed in to the root function, but have a tab hardcoded in the recursive function.
    5. omit undefined values that actually hold a place in the arrays

    Those are issues that I can see, pretty quickly.

提交回复
热议问题