Skip to Content
Programming PERL in the .NET Environment
book

Programming PERL in the .NET Environment

by Yevgeny Menaker, Michael Saltzman, Robert J. Oberg
September 2002
Intermediate to advanced content levelIntermediate to advanced
496 pages
10h
English
Addison-Wesley Professional
Content preview from Programming PERL in the .NET Environment

Expressions

Internally, PerlNET uses Perl interpreter. This allows us to incorporate all the standard Perl features and expressions in our PerlNET programs. This means that all samples that we introduced in Part 1 may be compiled and executed in the .NET environment without any changes. Let us demonstrate this by a simple Core Perl program, the standard Perl script freq.pl for counting word occurrences, which we presented in Chapter 4. Here is the code for the script.

#
# freq.pl
#
while(<STDIN>)
{
   @words = split;
   foreach $word (@words)
   {
      $words{$word}++;
   }
}
foreach $word (sort(keys(%words)))
{
   print "$word occurred $words{$word}\n";
}

Now, we may run the script either using Perl interpreter,

perl freq.pl

or by compiling into a .NET assembly ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Sams Teach Yourself Perl in 21 Days, Second Edition

Sams Teach Yourself Perl in 21 Days, Second Edition

Laura Lemay, Rafe Colburn
Pro Perl

Pro Perl

Peter Wainwright

Publisher Resources

ISBN: 0130652067Purchase book