4 ms·
> The author is 100% correct on everything. Programming is massively over-complicated for no useful reason. What are you trying to do? Say I'm Santa and have
by iso1631 6y ago
> The author is 100% correct on everything. Programming is massively over-complicated for no useful reason.
What are you trying to do?
Say I'm Santa and have a list of names in "naughtynice.lst", in the format
Joey Bloggs,train,nice
Johnny Doe,car,naughty
Mary Lamb,car,nice
etc
I can get my shopping list by simply creating a file on my machine
my $i = 0;
my $toys = {};
my $coal = 0;
while (<>) {
chomp;
my ($name, $toy, $nice) = split(/,/);
if ($nice eq "nice") {
$toys->{$toy}++;
} else {
$coal = $coal++;
}
}
print "$_: ".$toys->{$_}."\n" foreach keys (%{$toys});
print "coal: $coal\n";
and then typing
perl test.pl naughtnice.lst
to run it. Python I assume is similar. I'm fairly sure that OSX comes with perl, python and bash if nothing else.
Now you could say that you don't like the syntax of perl, or python, or basic, or java, but actually knocking up a quick program and running is no harder than writing that same code in some hidden part of excel