factorio-recipe-analyzer/fra.pl

13 lines
497 B
Perl

open(my $in, "<", "./mod-recipes/intermediate.csv") or die "Can't open intermediates.csv";
open(my $out, ">", "./mod-recipes/output.csv") or die "Can't open output.csv";
while (<$in>) {
@line = split(",", $_);
if ($line[1] =~ /(iron|steel|copper|zinc|tungsten|titanium|tin|nickel|silver|platinum|manganese|lead|gold|aluminium)/) {
$line[0] = 'metal'
}
my $lineout = join (',', @line);
print $out "$lineout";
}
close $in or die "$in: $!";
close $out or die "$out: $!";