#!/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 ($_ =~ /^\Q0.0.0.0\E (.*)$/){ print $file "local-zone: \"" . $1 . "\" redirect\nlocal-data: \"" . $1 . " A 0.0.0.0\"\n"; }