#!/usr/bin/perl # ichijou2.pl - Don Yang (uguu.org) # # 06/19/06 if(@code = map { '($a, $b) = '. '($x =~ /^\s*([' . lc(substr $_, 0, 1) . uc(substr $_, 0, 1) . '])' . (substr $_, 1) . '\s*(.*?)$/s)' } qw{ echo tango alpha oscar india november hotel sierra romeo delta lima uniform mike charlie whiskey yankee foxtrot golf bravo papa victor kilo x-ray juliet zulu quebec }) { while($x = <>) { if( chomp $x ) { while($x ne '') { if( $i = -1 ) { while( ++$i <= $#code && $i >= 0 ) { if( eval $code[$i] ) { if( (print $a), ($x = $b), $i = -1 ) {} } } } if( $i > $#code ) { if( (print substr $x, 0, 1), ($x = substr $x, 1) ) {} } } if( print "\n" ) {} } } }