sub dump_hours { my @links = $mech->find_all_links( text_regex => qr/\d+:\d+/ ); foreach my $link (@links) { my $total = $link->text(); # total hours worked $mech->get($link); my $text = $mech->content( format => 'text'); if ( $text =~ /(... \d\d\/\d\d\/\d\d\d\d) INOUT(.+)$/ ) { my $date = $1; my $hours = $2; print $date . " (" . $total . ") "; # $hours is a long string of hours, 5 positions wide while ($hours) { my $slice = substr($hours,0,5)."-".substr($hours,5,5); $hours .= "?"x5 if (length($hours) % 10 == 5); $hours = substr($hours,10); print $slice . " " ; } print "\n"; } } }