#!/usr/local/bin/perl -w use strict; use POSIX; # added after observing BrowserUK's code my (%schedule, $backup_type); my $today = strftime( '%A', localtime ); # changed after observing BrowserUK's code while (my $line = ) { chomp $line; my $count = 0 ; if ($line =~ /schedule:\s+(\w+)/i){ my $count++; $backup_type = $1; } if ( $line =~ /(\w+day)\s+(\d{2}\:\d{2}\:\d{2})/i ){ $schedule{$1} = { 'backup_type' => $backup_type, 'time' => $2 }; } } printf "Today is %s and the backup type is %s to begin at %s\n", $today, $schedule{$today}->{'backup_type'}, $schedule{$today}->{'time'}; __DATA__ ...etc