Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
Man, those Windows users are such lazy bastards. Too damn lazy to install a decent Unix toolkit, and too damn lazy to write a trivial Perl program. All they can do is whine that a solution is too Unix specific (never mind the fact that an open source solution for any Unix toolkit is available, not something we can say about Windows tools, can we?) Djees, you give them Perl - the portable Unix - and they still aren't satisfied.
#!/usr/bin/perl use strict; use warnings; no warnings qw /syntax/; use Getopt::Long; my ($show_ends, $show_tabs, $show_nonprinting); GetOptions ("A|show-all" => sub {$show_ends = 1; $show_tabs = 1; $show_nonprinting = 1}, "e" => sub {$show_ends = 1; $show_nonprinting = 1}, "E|show-ends" => sub {$show_ends = 1}, "t" => sub {$show_tabs = 1; $show_nonprinting = 1}, "T|show-tabs" => sub {$show_tabs = 1}, "v|show-nonprinting" => sub {$show_nonprinting = 1}, ); while (<>) { chomp; s/([\x80-\xFF])/"M-" . chr (ord ($1) - 0x80)/eg if $show_nonprinti +ng; s/([\x00-\x08])/"^" . chr (ord ($1) + 0x40)/eg if $show_nonprinti +ng; s/([\x0A-\x1F])/"^" . chr (ord ($1) + 0x40)/eg if $show_nonprinti +ng; s/\x7F/^?/g if $show_nonprinti +ng; s/\x09/^I/g if $show_tabs; s/$/\$/ if $show_ends; print "$_\n"; } __END__
Took less than 15 minutes to write and test.

Abigail


In reply to Re: Unbelievably Obvious Debugging Tip by Abigail-II
in thread Unbelievably Obvious Debugging Tip by dreadpiratepeter

Title:
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!
  • 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
  • Outside of code tags, you may need to use entities for some characters:
            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?
    Username:
    Password:

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

    How do I use this? | Other CB clients
    Other Users?
    Others taking refuge in the Monastery: (7)
    As of 2014-10-23 22:12 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      For retirement, I am banking on:










      Results (129 votes), past polls