I have since updated this script:
Code:
sub Create {
my $merchant_id = shift;
my $data = shift;
my @items = split(/ /, $data);
chomp $items[$#items];
print "Starting!\n";
open my $file, ">Merchant $merchant_id.sql";
my $message;
my $n = 1;
foreach my $item (@items) {
print "Adding item $item.\n";
$message .= "INSERT INTO `merchantlist` VALUES ('$merchant_id', '" . $n++ . "', '$item', '-1100', '', '0', '65535', '100');\n";
}
say $file $message;
print "Done!\n";
close $file;
}
print "What is the merchant id?\n";
my $merchant_id = int(<STDIN>);
print "List the items you would like on the merchant.\n";
my $data = <STDIN>;
Create($merchant_id, $data);
Here is an example of use:
