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):
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.