in reply to Re: Making this script process 56,000 lines 5 times faster
in thread Making this script process 56,000 lines 5 times faster

Hi kris004,

Another option is having Perl read the Curl output directly versus using LWP::Simple. The "-|" mode for open means the string that follows is interpreted as a command that pipes the output to us. See open function.

#!/usr/bin/perl use strict; use warnings; my $input = "https://raw.githubusercontent.com/StevenBlack/hosts/mast +er/hosts"; my $output = "ads.conf"; open my $IN, "-|", "curl $input" or die "open error $input: $!"; open my $OUT, ">", $output or die "open error $output: $!"; while ( <$IN> ) { if ( /^0\.0\.0\.0 (.*)$/ ) { print {$OUT} "local-zone: \"" . $1 . "\" redirect\nlocal-data: \"" + . $1 . " A 0.0.0.0\"\n"; } } close $IN; close $OUT;

Regards, Mario