Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Very nice! The way you mirrored the text is very pleasing, and the substitution and its reflection are very clever.

I would like to stake my own claim to having the first symmetrical JAPH, though.

This code was actually written to demonstrate a little-known operator in Perl. Of course, you're familiar with the "spaceship operator", <=>, so named because it resembles Darth Vader's TIE Fighter in Star Wars. Well, this code uses the super spaceship operator, <<=>>.

1. < 0, push @ tnirp => <<=>> <= print @ hsup ,0 > .1 Just another Perl hacker rekcah lerP rehto +na tsuJ ; print @ tnirp ;
That was written in September 1999, and was inspired by something Benjamin Holzmann wrote for The Perl Conference 3.0. There is a more complicated version which doesn't print the reflection, but it's not as aesthetically pleasing, so I prefer this one.

An obscure bug in 5.6.0 forced me to rewrite my script for that version (the bug has been fixed for 5.6.1). Fortunately, the super spaceship operator still works.

.1 . m || <= 0, push @ tnirp => <<=>> <= print @ hsup ,0 => || m . + 1. Just another Perl hacker rekcah lreP rehto +na tsuJ ; print @ tnirp ;

In reply to Super Spaceship Operator by chipmunk
in thread lp.hpajnilap.palinjaph.pl by jima

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 examining the Monastery: (7)
As of 2024-04-19 09:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found