Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Sadly,

This japh isn't as robust as my original plans, but it does fit on the four lines that is recommended. The full version takes data from a file and performs checks on that, which is much more interesting. Oh well. here it is:

#!/usr/bin/perl -w use strict; $;='|';@_=(0,0);@;=map[split/,/],split/;/,"',106,0,0,1;1,',0,1,0;0,0 ,',1,1;0,97,112,',0;1,0,104,0,'";{$;[$_[0]][$_[1]]=~/[1-9]/?($;{$_[ $;eq'|']}++&&last,$;=$;eq'-'?'|':'-',$_{$;[$_[0]][$_[1]]}++,($_[$;eq '|']+=1)%=@;):(($_[$;eq'|']+=1)%=@;);redo}print chr for reverse keys%_
enjoy,
jynx

update: one of these days i'm going to finish something before i post it. *sigh*, maybe. oh well, here's an updated version, a bit more interesting i think...

#!/usr/bin/perl use strict; @;=map[split/,/],split/;/,<DATA>;--$|;{$;[$_[0]][$_[1]]=~ /[1-9]/?($;{$_[$|--]}++&&last,$_{$;[$_[0]][$_[1]]}++):8,( $_[$|]+=1)%=@;;redo}print chr for reverse 10,keys%_ __END__ ',106,0,0,88;4,',0,7,0;0,0,',12,94;0,97,112,',0;5,0,104,0,'
nuf evah...

update2: d'oh! This seems to have been broken on perl 5.8. i tested multiple platforms with perl 5.6 and it seemed to work correctly (otherwise i wouldn't have posted it at all). Hmm, if i get time i'll reply to this post with an updated version that works... *sigh*, one of these days...


In reply to No bridges please... by jynx

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (1)
As of 2024-04-25 12:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found