Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
made it a bit faster. You need Tie::CharArray, but it is worth the speedup.
use strict; use warnings; use Tie::CharArray; use Compress::Zlib; ++$|; my $filename = $ARGV[0] || die "usage: need a filename"; if ( ! -f "$filename" ) { print STDERR "couldn't open: $filename\n"; exit(-1); } open IN, $filename or die $!; binmode IN; read IN, my $stringdata, 1e8; tie my @data, 'Tie::CharArray', $stringdata; my $piecenum=0; my $progress = progress(length $stringdata); my $piecedata; for (0..length($stringdata)-1) { $progress->($_); shift(@data); $data[0] = "\x78"; $data[1] = "\x9c"; ( $piecedata = uncompress($stringdata)) || next; print "\nFound piece at $_\n"; open OUT, sprintf('>piece_%03d.txt', $piecenum++) or die $!; binmo +de OUT; print OUT $piecedata ^ chr(0xAA) x length $piecedata; } sub progress { my $max = $_[0]; my $last = 0; return sub { print $last = int(100*$_[0]/$max), "%... " if $last ! += int(100*$_[0]/$max) }; }

In reply to Re^2: decompile perlapp 4.1 by Anonymous Monk
in thread decompile perlapp 4.1 by sorenb

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

    No recent polls found