Evan Martin (evan) wrote in evan_tech,
Evan Martin
evan
evan_tech

perlc

At http://neugierig.org/software/perlc/ you will find an evening's hack by xaosenkosmos and me. Prompted by noticing in gcc's manual that identifiers may use $, we decided to see how much more Perl support we could do. The C file #includes the following program and runs it properly, without any preprocessing other than that built into GCC:
my $desc = "A wc-like program. Use 'perl -n c.pl < file'.";
my $letters;
my $lines;

sub process_line ($) {
  my $line = shift;
  $letters += length($line);
  $lines++;
}

process_line($_);

END {
  printf("letters: %d; lines: %d\n", $letters, $lines);
}
You can browse the source of the C program for more information. We went to great pains for exact Perl syntax.
Tags: project
Subscribe

  • megaupload captcha

    Someone make a Javascript-based captcha cracker for megaupload. It's strange to see those captchas again because I idly myself wrote a…

  • zombie ghosd

    I was tickled to discover another IBM developerworks article on one of my abandoned hacks and that both it and its predecessor have been translated…

  • gat, a git clone in haskell

    I've been pretty busy with work lately, so I may as well dump this on the internet before it gets too dusty. Though I think I understand Git decently…

  • Post a new comment

    Error

    default userpic
    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 10 comments

  • megaupload captcha

    Someone make a Javascript-based captcha cracker for megaupload. It's strange to see those captchas again because I idly myself wrote a…

  • zombie ghosd

    I was tickled to discover another IBM developerworks article on one of my abandoned hacks and that both it and its predecessor have been translated…

  • gat, a git clone in haskell

    I've been pretty busy with work lately, so I may as well dump this on the internet before it gets too dusty. Though I think I understand Git decently…