PERL, a simple scripting language

Perl is easy to learn yet quite powerful, and is quite useful. It combines the best attributes of the Bourne shell, awk, sed, C, etc., into a single language.

The example below takes two numbers from the keyboard and displays half the product of the first and the square of the second (to calculate the energy stored in a capacitor).


#Appropriated from one of the examples in Learning Perl:
#http://www.cis.ufl.edu/perl/learning_perl.ftp.html
print "What is the capacitance/Farad: ";
chop($capacitance = );
print "What is the emf/volt: ";
chop($voltage = <STDIN>);
$energy = 0.5 * $capacitance * $voltage * $voltage;
print "strobe: your capacitance of $capacitance F at $voltage v delivers $energy J\n";

To run the example above (in a file called strobe.perl):


/usr/local/bin/perl ./strobe.perl

Learning PERL

PERL: Practical Extraction and Report Language

PERL: Practical Extraction and Report Language (newer link to this site). This is a whole online book with nice examples.


Steve's personal Web page