Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The following works for me:

$b=this_code_is_from_perlmonks_org; for my $a(some_program_was_written_for_perlmonks_org=~/[st]/g){ print $a,sprintf '%4s','*'x(2+($a cmp $b)), qq(\n); $b=$a }

Update: I didn't get the requirement of outputting different depths, so here is an improved variation on the same theme:

$level=12; my $i=12; my $l=$level-12; $_ = #$; this_program_source_was_written_for_the_site_perlmonks_org. please_do_not_give_this_code_to_your_teacher_without_understanding. We_value_learning_but_the_work_has_to_be_done_by_yourself. kthxbai; $b=a_program_written_by_Corion; for $a(($_.reverse)=~/[sx]/g){ $d=($a cmp $b)||$d; $l+=$d; $b=$a; print sprintf '%'.$i.'s', '*'x$l, qq(\n) unless $l<0 }

In reply to Re: asterisk pattern by Corion
in thread asterisk pattern by Monk_perl

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others scrutinizing the Monastery: (5)
    As of 2018-06-18 02:33 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (107 votes). Check out past polls.