24 lines
840 B
Perl
24 lines
840 B
Perl
open(my $in, "<", "./mod-recipes/intermediate.csv") or die "Can't open intermediates.csv";
|
|
open(my $out, ">", "./mod-recipes/raw.csv") or die "Can't open raw.csv";
|
|
|
|
raw_ingredients();
|
|
|
|
sub raw_ingredients () {
|
|
$product = $ARGV[1];
|
|
while (<$in>){
|
|
@line = split(",", $_);
|
|
if ($line[1] == $product) {
|
|
print "ingredients $line[4]\n";
|
|
@ingredients = split(/\+/, $line[4]);
|
|
print "\t\@ingredients: @ingredients \n";
|
|
foreach my $ingredient (@ingredients) {
|
|
print "\t\t\$ingredient: $ingredient\n";
|
|
raw_ingredients($ingredient);
|
|
print "\t\t\trecurring! \$ingredient = $ingredient\n";
|
|
}
|
|
}
|
|
else {
|
|
continue;
|
|
}
|
|
}
|
|
}
|