Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re^2: Tree in perl

by saurabh2k26 (Initiate)
on Nov 17, 2014 at 15:57 UTC ( #1107433=note: print w/replies, xml ) Need Help??

in reply to Re: Tree in perl
in thread Tree in perl

Thanks, i tried this and it works and i am getting to understand it. But again, Data::Dump is not allowed in programming contests. Can you update your code without using Data::Dump

Replies are listed 'Best First'.
Re^3: Tree in perl
by roboticus (Chancellor) on Nov 17, 2014 at 16:03 UTC


    I just used Data::Dump to print the data structure to the screen. You don't need it at all, but I needed it or you wouldn't see what data structure was created. Once you understand the data structure and create your algorithm, you can present the results any way you like.


    When your only tool is a hammer, all problems look like your thumb.

Re^3: Tree in perl
by McA (Priest) on Nov 17, 2014 at 16:07 UTC

    You wanted to get a starting point. You got one, no two.

    Do you want to win a contest or do you want to learn Perl?


      syntax error at line 11, near "+ }"


        I don't see "+ }" in either code example. I suspect that you're cutting and pasting from the screen into your editor, because when formatted code lines wrap, the wrap is indicated with a "+" symbol. You can either remove the unwanted "+" symbols, or use the "download" link, in which case you'll get the code by itself in a web page which you can either right-click and "save as" or cut & paste without the "+" symbols appearing.

        Note: I don't know what your code wrap settings are, but you could always make them wider. (Neither code example wraps with the settings I use.

        Update: I just logged out and looked at the code--McA has two lines that wrap using the default settings, so try the download link. Also, when you're logged out, the plus symbols that indicate wrapping are shown in red, so that'll make the extra "+" symbols easier to find if you just want to delete them in your editor.


        When your only tool is a hammer, all problems look like your thumb.

      I am trying to removing syntax error from your code, but no success. Can you check it.


        just checked it again: My code (McA) doesn't have an syntax error. At least not on my machine. So, show us what your perl version is saying about the code.


    A reply falls below the community's threshold of quality. You may see it by logging in.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2022-08-14 19:43 GMT
Find Nodes?
    Voting Booth?

    No recent polls found