perl:index
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
perl:index [2009/09/04 10:08] – tkbletsc | perl:index [2010/01/08 13:50] (current) – tkbletsc | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Perl code snippets ====== | ====== Perl code snippets ====== | ||
+ | * [[Prototype class for OO]] | ||
* [[Real CSV Parsing]] | * [[Real CSV Parsing]] | ||
* [[ANSI color]] | * [[ANSI color]] | ||
Line 15: | Line 16: | ||
* [[Single document web server]] | * [[Single document web server]] | ||
* [[Read password without echo]] | * [[Read password without echo]] | ||
+ | * [[Amazon preview leech]] | ||
====== Blobs of code ====== | ====== Blobs of code ====== | ||
Line 24: | Line 26: | ||
sub sum { my $r=0; for (@_) { $r += $_ }; return $r; } | sub sum { my $r=0; for (@_) { $r += $_ }; return $r; } | ||
sub avg { return sum(@_)/@_; } | sub avg { return sum(@_)/@_; } | ||
+ | sub stdev { | ||
+ | my $s=0; | ||
+ | my $avg = avg(@_); | ||
+ | foreach (@_){ | ||
+ | $s += ($_ - $avg)**2; | ||
+ | } | ||
+ | return sqrt($s/ | ||
+ | } | ||
sub limits { | sub limits { | ||
my $lo = my $hi = $_[0]; | my $lo = my $hi = $_[0]; |
perl/index.1252084110.txt.gz · Last modified: 2009/09/04 10:08 by tkbletsc