in reply to extracting number from middle of string

If you have warnings turned on, you'll get that error if $_ is empty. Try:
$out_file = "out1"; open (OUT, "$out_file"); while (<OUT>) { next unless $_; if (/Time: (..):(..):(..)/) { $hours = $1; $mins = $2; $secs = $3; } } close (OUT); print "hours =: $hours";
Now, this *is* just test code, right? Note that you're checking every line for this match, but then you print after your while loop completes. You may want to bail once you've hit the match.

For testing simple things like this early in development, I often use those whacky in-code filehandles: __DATA__. So, I'd do something like this:
while (<DATA>) { if ($_ && /Time:\s+(\d+):(\d+):(\d+)/i) { $hours = $1; $mins = $2; $secs = $3; last; } } print "hours =: $hours"; __DATA__ Time: 04:45:12
Give it a shot. It's cool! All the kids are doing it...