#!/usr/bin/perl use strict; use warnings; # use diagnostics; use File::Find; use Date::Parse; find \&process, 'tmp'; exit 0; { my $output_dir; BEGIN { $output_dir = '/home/hynek/old-blog/new'; } sub process { if ( -f $_ && /\.html$/ ) { my ( $time, $text ) = parse( $File::Find::name ); ( my $output_file = "$output_dir/$_" ) =~ s/html$/txt/; print_out( $text, $output_file ); utime $time, $time, $output_file; } } } sub parse { my $input_file = shift; open my $in, "<:utf8", $input_file or die "Can't read $input_file: $!"; my ( $time, $subject, $text ); while ( <$in> ) { $time = Date::Parse::str2time( $1 ) and next if !$time && /\w+, (\w+ \d\d, \d\d\d\d)/; chomp; # is this *really* necessary for all lines? my $match_no; if ( $match_no = ( m%