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/08/13 09:57] – Links to real_csv_parsing changed to perl:real_csv_parsing tkbletsc | perl:index [2010/01/08 13:50] (current) – tkbletsc | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
- | * [[real_csv_parsing]] | + | * [[Prototype class for OO]] |
- | * [[:ansi_color]] | + | * [[Real CSV Parsing]] |
- | * [[sets]] | + | * [[ANSI color]] |
- | * [[dns_stuff]] | + | * [[Sets]] |
- | * [[make_a_loop_parallel]] | + | * [[DNS stuff]] |
- | * [[command_line_options_and_usage_with_getopt_long]] | + | * [[Make a loop parallel]] |
- | * [[command_line_options_and_usage_with_getopts]] | + | * [[Command line options and usage with Getopt Long]] |
- | * [[command_line_options_with_usage]] | + | * [[Command line options and usage with getopts]] |
- | * [[for_each_file]] | + | * [[command line options with usage]] |
- | * [[forking_server]] | + | * [[For each file]] |
+ | * [[Forking server]] | ||
* [[kvpff]] | * [[kvpff]] | ||
- | * [[loop_with_timekeeping]] | + | * [[Loop with timekeeping]] |
- | * [[single_document_web_server]] | + | * [[Single document web server]] |
- | * [[read_password_without_echo]] | + | * [[Read password without echo]] |
+ | * [[Amazon preview leech]] | ||
- | ====== | + | ====== |
<code perl> | <code perl> | ||
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]; | ||
Line 67: | Line 77: | ||
'< | '< | ||
} | } | ||
+ | |||
+ | sub size_units { | ||
+ | my ($n) = @_; | ||
+ | if ($n> | ||
+ | if ($n> | ||
+ | if ($n> | ||
+ | if ($n> | ||
+ | return $n; | ||
+ | } | ||
+ | |||
+ | sub parse_size_units { | ||
+ | my ($s) = @_; | ||
+ | if ($s=~/ | ||
+ | if ($2 eq ' | ||
+ | elsif ($2 eq ' | ||
+ | elsif ($2 eq ' | ||
+ | elsif ($2 eq ' | ||
+ | else | ||
+ | } else { | ||
+ | return undef; | ||
+ | } | ||
+ | } | ||
+ | |||
perl/index.1250182632.txt.gz · Last modified: 2009/08/13 09:57 by tkbletsc