in reply to Re^2: Scraping a website
in thread Scraping a website

Some further comments. Use the three argument form of open:

open(my $fh, ">", "output.txt") or die "Can't open > output.txt: $!";

Detailed explanation.

In general I think you've over complicated the problem. I'd avoid using curl and parsing the results with a regex. Look at Mojo::DOM, Mojo::UserAgent and Super Search for examples of both. Very powerful tools that make this sort of work trivial.