#!/usr/bin/perl use strict; use warnings; use LWP::Simple; my $url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"; open(my $file, '>', 'ads.conf') or die "wtfile?"; for (split /^/, get ($url)) { if ($_ =~ /0\.0\.0\.0/ and $_ !~ /#/){ $_ =~ s/0\.0\.0\.0 //; $_ =~ s/\n//; print $file "local-zone: \"" . $_ . "\" redirect\nlocal-data: \"" . $_ . " A 0.0.0.0\"\n"; } } close $file;