Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: ASCII art maker

by trizen (Hermit)
on Dec 25, 2011 at 03:57 UTC ( [id://945052]=note: print w/replies, xml ) Need Help??


in reply to ASCII art maker

my $char = '%'; my (@table) = ( 'c:1', 's:3', 'c:1', 's:2', 'c:1', 's:2', 'c:4', 's:2', 'c:5', 's:2', 'c:1', 'n:1', 'c:2', 's:2', 'c:1', 's:2', 'c:1', 's:2', 'c:1', 's:5', 'c:1', 's:6', 'c:1', 'n:1', 'c:1', 's:1', 'c:1', 's:1', 'c:1', 's:2', 'c:1', 's:2', 'c:1', 's:5', 'c:5', 's:2', 'c:1', 'n:1', 'c:1', 's:2', 'c:2', 's:2', 'c:1', 's:2', 'c:1', 's:5', 'c:1', 'n:1', 'c:1', 's:3', 'c:1', 's:2', 'c:1', 's:2', 'c:4', 's:2', 'c:5', 's:2', 'c:1', 'n:1', ); my (%sc) = ( 's' => ' ', 'c' => $char, 'n' => "\n", ); foreach my $data (@table) { my ($c, $t) = split(/:/, $data, 2); print $sc{$c} x $t; } __END__ # Code used to generate the table while ($ascii_art =~ /(\S+| +|\n+)/g) { my $m = $1; my ($l, $o) = (length($m), ord($m)); push @table, $o == 32 ? "s:$l" : $o == 10 ? "n:$l" : "c:$l"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://945052]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2024-04-20 03:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found