sudo port install perl5.10
---> Fetching perl5.10 ---> Attempting to fetch perl-5.10.0.tar.gz from http://www.cpan.org/src/5.0/ ---> Verifying checksum(s) for perl5.10 ---> Extracting perl5.10 ---> Applying patches to perl5.10 ---> Configuring perl5.10 ---> Building perl5.10 with target all ---> Staging perl5.10 into destroot ---> Installing perl5.10 5.10.0_1+darwin_8 ---> Activating perl5.10 5.10.0_1+darwin_8 ---> Cleaning perl5.10
#!/opt/local/bin/perl5.10.0 use strict; use warnings; use feature ":5.10"; say "Yeah!!!!"; say "Hello, Woooooorld"; my $a; my $b = $a // 1; # defined $a ? $a : 1; say $b; $a //= $b; # $a = $b unless defined $a; say $a;
use pQuery; pQuery("<div><h2>a1</h2><h2>a2</h2><h2>a3</h2></div>") ->find("h2") ->each(sub { my $i = shift; print $i + 1, ") ", pQuery($_)->text, "\n"; });
これ(↑)はうまく動いたんだけど、なぜか SYNOPSYS にもある% ./prog.pl 1) a1 2) a2 3) a3
pQuery("http://google.com/search?q=pquery") ->find("h2") ->each(sub { my $i = shift; print $i + 1, ") ", pQuery($_)->text, "\n"; });