in reply to Challenge: Reading Banner Text
~/ $ banner Just another Perl hacker | ./unbanner.pl JustanotherPerlhacker
... You can guess the rest of the data section#!/usr/bin/perl use strict; my @alphabet=("a".."z"); push @alphabet , ("A".."Z"); my $index=0; my $output=""; my %letter; my $spaces=0; while (<DATA>){ if (/^\s*$/){ $letter{$output}=$alphabet[$index]; $index++; $output=""; $spaces++; } else { $output .= $_; } } my @output; @output = <STDIN>; my $char=""; for my $line (@output){ if ($line =~/^\s*$/){ print $letter{$char}; $char=""; $spaces++; } else { $char .= $line; } } print "\n"; __DATA__ ######## ################ #################### ######################## + ##### ########################## # +######### ############################ ## +########### ############################## ## +############ ######### ######### ## +############# ######## ######## # +############# ####### ####### + #### ###### ###### ###### + ##### ###### ###### + #### ###### ###### + #### #####
|
|---|