in reply to Re^4: Programming Language to generate Perl Scripts
in thread Programming Language to generate Perl Scripts
Wouldn't it be a mess of single quotes and double quotes?
No. For the reasons I already gave, it would be less of a mess in Perl.
Perl: print($fh q{for (keys(%h)) { print("$_: $h{$k}\n"); }}); C: fprintf(fh, "for (keys(%%h)) { print(\"$_: $h{$_}\\n\"); }"); fprintf(fh, "%s", "for (keys(%h)) { print(\"$_: $h{$_}\\n\"); }"); fputs("for (keys(%h)) { print(\"$_: $h{$_}\\n\"); }", fh);
3 or 4 extra escapes in C.
|
|---|