It's not fair to compare the core of C with Perl. They are not on the same level. Perl is like C with lots of handy and powerful libraries, and Perl has built-in memory management.
Ok, let's give C the additional libraries DIE, ARRAY, FILE, HASH and SPLIT, and the competition is more fair.
#include <stdio.h>
#include <DIE.h>
#include <ARRAY.h>
#include <HASH.h>
#include <SPLIT.h>
#include <FILE.h>
int main(int argc, char **argv)
{
FILE *f;
char *buf;
HASH *h = new HASH();
if ((f = fopen("data", "r")) == NULL)
DIE("unable to open file");
while(buf = READFILE(f)) {
ARRAY *ar = SPLIT(buf);
h->AddElement(ar[0], ar[1]);
free(ar);
free(buf);
}
printf("price of apple is : %s\n", h->GetElement("apple"));
fclose(f);
return(0);
}