[tye] gah, some kind of new-age meeting format.
[Tanktalus] Tanktalus is trying to imagine a meeting room full of long-haired people wearing braids, smoking marijuana, and listening to Zamphyr...
[RonW] That's the "old" "new age"
[Tanktalus] Tanktalus can't keep up :)
####
sub mapxml {
my $xml = shift;
my ($tag, $value, %xmlhash);
my @lines = (split /\n/, $xml);
chomp @lines;
while (@lines) {
my $line = shift @lines;
($tag,$value) = ($line =~ /<([\w:]+?\/?)>([^<]*)/);
next if (! defined($tag) || (substr($tag,-1) eq '/'));
if ($value =~ /[\w:-\\]+/) {
$xmlhash{$tag} = $value;
} else {
my $contents = "";
while (1) {
$line = shift (@lines);
last if ($line eq '' . $tag . '>');
$contents .= $line . "\n";
}
$xmlhash{$tag} = mapxml($contents);
}
}
return \%xmlhash;
}
##
##
use Test::Simple tests => 2;
ok(1 == 1, 'Identity theorem');
ok( &ask eq 'yep', 'User response test');
sub ask {
print "Are you a human?\n";
$answer = ;
chomp $answer;
return($answer);
}
##
##
use strict;
use warnings;
my $plaintext = 'We are discovered. Flee at once!';
my $key = 'CorrectBatteryHorseStaple';
print "Original message: $plaintext\n";
my $ciphertext = pack('u',cypher($plaintext,$key));
print " Encoded message: $ciphertext\n ";
my $decoded = cypher(unpack('u',$ciphertext),$key);
print " Decoded message: $decoded\n";
sub cypher {
my $plain = shift; my $key = shift;
my $i=0; my $j = length($key);
return join '', map {$_^substr($key,$i++ % $j,1)} (split '',$plain);
}
##
##
$pwd = join '', sort grep { ! $uniq{$_}++ } split //, $string;