After thinking about the problem a bit, you could, in theory, use "colspan" for a simplistic run-length compression:

#!/usr/bin/env perl use strict; use warnings; use Text::QRCode; my $qr = Text::QRCode->new()->plot("YAPH"); my $pixelsize = 15; my $black = '<td width="' . $pixelsize . 'px" height="' . $pixelsize . + 'px" bgcolor="black"></td>'; my $white = '<td width="' . $pixelsize . 'px" height="' . $pixelsize . + 'px" bgcolor="white"></td>'; print '<table border="0">', "\n"; my $firstline = 1; my $saved = 0; foreach my $line (@{$qr}) { print "<tr>"; my $firstelem = 1; my $width = 0; my $color = ''; foreach my $elem (@{$line}) { if($firstline) { # First line, no compression. This sets the correct column + width for all columns if($elem eq '*') { print $black; } else { print $white; } } else { if($firstelem) { $color = $elem; $width = 1; $firstelem = 0; } else { if($color eq $elem) { $width++; $saved++; } else { my $realcol = 'white'; if($elem eq '*') { $realcol = 'black'; } print '<td colspan="' . $width . '" height="' . $p +ixelsize . 'px" bgcolor="' . $realcol . '"></td>'; $color = $elem; $width = 1; } } } if(!$firstline) { # print last element of the current line my $realcol = 'white'; if($elem eq '*') { $realcol = 'black'; } print '<td colspan="' . $width . '" height="' . $pixelsize + . 'px" bgcolor="' . $realcol . '"></td>'; } $firstline = 0; } print "</tr>\n"; } print '<\table">', "\n"; print '<!-- run length compression saved ', $saved, ' table fields-->' +, "\n";

I've run into a formatting problem doing this (probably some stupid oversight on my part), but it might be worth the effort if you need to "compress" your code to the 64K limit in PerlMonks. See What is PerlMonks post size limit?

perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

In reply to Re^2: Shameless plug and QR japh by cavac
in thread Shameless plug and QR japh by bliako

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!
  • 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, details, 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, summary, 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.