Re: how to do this job using perl?



"sonet" <sonet.all@xxxxxxxxxxxxx> wrote in
news:dkqiin$72v$1@xxxxxxxxxxxxxxxxx:

[ Please do not top-post ]

> "sonet" <sonet.all@xxxxxxxxxxxxx> ¦b¶l¥ó
> news:dkqg48$fgs$1@xxxxxxxxxxxxxxxxx ¤¤¼¶¼g...
>> #items parent
>> 01.attr 0
>> 02.attr 0
>> 04.attr 01.attr
>> 03.attr 01.attr
>> 06.attr 02.attr
>> 07.attr 03.attr
>> 08.attr 03.attr
>> 09.attr 07.attr
>> =========================================
>> transform to this form
>> ps: The order must follow above
>> =========================================
>> 01.attr
>> 04.attr
>> 03.attr
>> 07.attr
>> 09.attr
>> 08.attr
>> 02.attr
>
>
> First, this is not a homework.

That is good.

> The Tree::Simple can do this job after i search modules in CPAN.
> But i don't want to do this by modules only if i can not slove it.

That's admirable. I think you should give it a try, and post your best
attempt. That will make it *easier* for us to help you.

> Sorry! My mother language is not english.And my english is very poor.

There is no need to apologize for poor English, especially if you post
code, because then we can figure out what you are trying to do and what
is not working by looking at the code. That is why the posting guidelines
recommend:

Speak Perl rather than English, when possible

Perl is much more precise than natural language. Saying it in
Perl instead will avoid misunderstanding your question or problem.

Do not say: I have variable with ``foo\tbar'' in it.

Instead say: I have $var = ``foo\tbar'', or I have $var = 'foo\tbar',
or I have $var = <DATA> (and show the data line).

You can find the posting guidelines at

http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html

Do read them, they contain invaluable pointers on how to help yourself,
and help others help you.

> Just give a suggestion.

Use a hash :) (just joking)

The question itself is a little more complicated than I can figure out
right now (which is why I personally would use the module for the
immediate problem, and then try to read the source code, or consult an
algorithms book to see how to do it).

Sinan
.



Relevant Pages

  • Re: regexp: read ip address
    ... Read the posting guidelines for this group. ... Do the best you can to write your program in Perl; ... using warnings and strict; and posting a small complete program ... people who haven't taught themselves English as well as he has. ...
    (comp.lang.perl.misc)
  • Re: Strange behaviour with character
    ... > Saying it in Perl is always better than trying to say it in English. ... Posting Guidelines, for this group or for any group? ...
    (comp.lang.perl.misc)
  • Re: how can I find the driver list in perl
    ... Or English literature group>? ... This is the Perl programming newsgroup you know... ... There is no such command in the Perl language. ... There are so many grammatical problems with that "paragraph" it's not ...
    (comp.lang.perl.misc)
  • Re: noob: Trying perl, and decoding MIME attachments..stuck in my code..can someone take a look?
    ... having lexical variables is a positive reason :-). ... For Perl this means that most of the time the declaration should be ... Have you seen the posting guidelines that are posted here frequently? ...
    (comp.lang.perl.misc)
  • Re: start_table problem
    ... The Posting Guidelines suggest many ways to increase your ... The command lines switches for the "perl" program are documented in: ...
    (comp.lang.perl.misc)