How each drove me crazy

I had a program like this:

my @data = qw( bla fasel foo org jawohl hmblamm glfoo sdfoo sadfasffoo) ;

my %regex = ( type1 => bla, type2 => foo);

foreach(@data) {
print $_,"\t";
print " matches " if test_it($_);
print "\n";
}

sub test_it {
my $entry = shift;
while( my($type, $regex) = each %regex) {
return 1 if $entry =~ /$regex/;
}
return 0;
}

I expected:
bla matches
fasel
/var/www/users/vkroll/index.html

On development in perl

If you go to a bookstore to get some books about modern software development, you will find a lot there, but all these books are written from and written for the "java-guys". In my opinion we need to show, that you can use all these techniques in perl too...

Test Driven Development
I cannot remember a time, where modules in perl from cpan were without a test-suite, and we have many test-modules out there, but all the books about tdd are about Java or .Net.

Automatic Acceptance Tests
All agile developers love automatisation. There is ="http://fi…

About vkroll

user-pic I blog about Perl and "modern software development", english is not my mother tongue (I am german), so I hope you get, what I mean :-)