in reply to printing to filehandles

It looks like you want this to run indefinitely ($times is never set to zero anywhere in the while loop), so you may want to reduce the load it places on your system (and simplify the code and the extent of indentation) by removing this:
if ($min >= $oldmin+5 || $oldmin-$min >= 54){
(and its matching close-bracket) and putting "sleep 60 * 5;" just before the close bracket of the while loop.

Since you'll only be writing a small amount of data to each output file once every 5 minutes, you'll want to make sure that autoflushing is turned on for each file handle, or else (better yet) always  open( HANDLE, ">>$filename" ) or die "$filename: $!"; on each output before writing, and always close the outputs after writing, on every iteration. As for other minor details:

You initialize "$oldmon" to zero, then you set "$mon" via "localtime time", and then you say:

if ($mon != $oldmon){ ...
You should read "perldoc -f localtime", and work out what your code would do if you started it up in January.

Your regexes for pulling the target data out of the web page will need to be fixed when that web site decides to change its appearance or other irrelevant details. (For example, when I checked the page source for that url just now, I saw that the third cell in each table row has quotes on the 'color=' attribute value of the "td" tag, which won't get matched in your code.)

Some monks might suggest using an HTML parser, but here's a slightly modified version of your approach that might make things easier and somewhat more robust:

my @pagesource = split( /<\/tr>/, $pagesource ); my $found = 0; for ( @pagesource ) { if ( /(EUR\/USD).*?(\d+\.\d+).*?(\d+\.\d+)/s ) { # open output files here... print OUT "$1,$mon:$mday:$year:$hour:min,$2,$3\n"; print DAY "$1,$mday:$hour:$min,$2,$3\n"; print MONTH "$1,$mday:$hour:$min,$2,$3\n"; $found++; # close output files here... last; } } print "No EUR/USD data found.\n" unless ( $found );
Note that this will not print anything from the page if the regex doesn't match, but at least you'll get a notification on STDOUT that the match is failing.