This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time perl -MList::Util=reduce -le 'print reduce { $a + $b } (1..1000000)' | |
500000500000 | |
perl -MList::Util=reduce -le 'print reduce { $a + $b } (1..1000000)' 0.22s user 0.05s system 98% cpu 0.275 total | |
$ time ruby -e 'puts (1..1000000).inject(0) {|x,i| x+i}' | |
500000500000 | |
ruby -e 'puts (1..1000000).inject(0) {|x,i| x+i}' 0.14s user 0.04s system 98% cpu 0.187 total | |
$ time perl6 -e 'print [+] 1..1000000' # rakudo star 201201 | |
500000500000perl6 -e 'print [+] 1..1000000' 478.78s user 5.98s system 99% cpu 8:08.09 total | |
$ time perl6 -e 'print [+] 1..1000000' # rakudo star 201205 | |
500000500000perl6 -e 'print [+] 1..1000000' 25.94s user 0.67s system 99% cpu 26.626 total |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require File.expand_path(File.dirname(__FILE__) + '/edgecase') | |
class AboutControlStatements < EdgeCase::Koan | |
# … | |
def test_while_statement | |
i = 1 | |
result = 1 | |
while i <= 10 | |
result = result * i | |
i += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
fall(1); | |
} | |
int fall(int e) | |
{ | |
int a = 1/(1001-e); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl -E'open my $fh, "test"; print {$fh} "butts"' | |
$ perl -Mwarnings -E'open my $fh, "test"; print {$fh} "butts"' | |
Filehandle $fh opened only for input at -e line 1. | |
$ perl -Mwarnings -Mdiagnostics -E'open my $fh, "test"; print {$fh} "butts"' | |
Filehandle $fh opened only for input at -e line 1 (#1) | |
(W io) You tried to write on a read-only filehandle. If you intended | |
it to be a read-write filehandle, you needed to open it with "+<" or | |
"+>" or "+>>" instead of with "<" or nothing. If you intended only to | |
write the file, use ">" or ">>". See "open" in perlfunc. | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The following changes, which occurred between FreeBSD 7.3-RELEASE and | |
FreeBSD 7.4-RELEASE have been merged into /etc/passwd: | |
--- current version | |
+++ new version | |
@@ -1,6 +1,6 @@ | |
-# $FreeBSD: src/etc/master.passwd,v 1.40.24.1 2010/02/10 00:26:20 kensmith Exp $ | |
+# $FreeBSD: src/etc/master.passwd,v 1.40.26.1 2010/12/21 17:10:29 kensmith Exp $ | |
# | |
root:*:0:0:Charlie &:/root:/bin/tcsh | |
toor:*:0:0:Bourne-again Superuser:/root: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!grep { $action eq $_ } @Controller::actions) { | |
unshift(@parts, $action, 404); | |
$action = 'error'; | |
} | |
# … | |
my $sub; | |
{ | |
no strict 'refs'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aptitude install collectd | |
The following NEW packages will be installed: | |
collectd collectd-core{a} dbus-x11{a} gconf2{a} libasound2{a} libcanberra-gtk-module{a} | |
libcanberra-gtk0{a} libcanberra0{a} libcap-ng0{a} libesmtp5{a} libhal1{a} libmemcached5{a} | |
libnl1{a} libnotify1{a} libogg0{a} libopenipmi0{a} liboping0{a} libprotobuf-c0{a} | |
libpython2.6{a} libstartup-notification0{a} libtdb1{a} libtokyotyrant3{a} libupsclient1{a} | |
libvirt0{a} libvorbis0a{a} libvorbisfile3{a} libwnck-common{a} libwnck22{a} libxcb-aux0{a} | |
libxcb-event1{a} libxenstore3.0{a} libxres1{a} libyajl1{a} notification-daemon{a} rrdtool{a} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# example perl code shipped by a company who seems to have written their backend in perl: | |
for(my $i = 0; $summaries->[$i]; $i++) { | |
my $summary = $summaries->[$i]; | |
# … | |
my $offerIds =$summary->{"offerIDs"}; | |
for(my $j = 0; $offerIds->[$j]; $j++) { | |
print "Offer ID: " . $offerIds->[$j] . "\n"; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perlbrew exec perl -e version::new | |
perl-5.10.1 | |
========== | |
sh: line 1: 21919 Segmentation fault perl \-e version\:\:new | |
perl-5.12.2 | |
========== | |
sh: line 1: 21922 Segmentation fault perl \-e version\:\:new |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
perl -E 'say for sort { length $b <=> length $a } map { (split /\t/)[-1] } split /\n/, do "unicore/Name.pl"' |