Perl: the Markov chain saw PerlMonks

 on Jun 01, 2004 at 18:39 UTC Need Help??

```+-+-+-+-+
|?| | | |  first step: place a photo in the "?" cell
...
+---+/+-+                         ***
|///|/|?|
+---+-+-+  first photo that fits is the 1x1
```
```+---+-+-+
|///|/|/|
...
+---+-+-+
|///|/|/|
+---+-+-+
```
```{
my %seen;
...
}

}
```
```<table border=1>
<tr><td></td><th>PM Markup:</th><th>Result:</th></tr>
...
</td></tr>

</table>
```
```# input:
#  - env = mapping of variable names to types
...

return ( resulttype, constr1 + constr2
+ "type1==FuncType(type2,resulttype)
+" );
```
```# unify a list of constraints:
#  - input = list of constraints of the form "lhs==rhs"
...
## FuncType, or other such impossible feats
else
croak "unification impossible!";
```
```## two containers that have the same value
my \$x = 1;
...

\$x = 5;     ## change the value in one container ...
print \$y;   ## the other container is unaffected
```
```my \$x = 1;
my \$y = \\$x; ## \$y is a reference to \$x

\$x = 5;
print \$\$y;
```
```my \$x = 0;
sub { \$_[0] = 5 }->(\$x);

print "\$x\n";
```
```my \$x = 0;
my \$y = sub { \$_[0] }->(\$x); ## my \$y = .. assignment operator

\$y = 5;
print "\$x\n"; ## still 0
```
```my \$x    = 0;
my \$arr = sub { \@_ }->(\$x);

\$arr->[0] = 5;
print "\$x\n"; # 5
```
```my \$arr = do {
my \$x;
...

\$arr->[0] = 5;
print "@\$arr\n"; ## 5 5
```
```my \$x = 0;
map { \$_ = 5 } \$x;
...
my \$x = 0;
grep { \$_ = 5 } \$x;
print "\$x\n";
```
```my \$x = 0;
foreach my \$y (\$x) { \$y = 5 }
print "\$x\n";
```
```my \$x = 0;
*y = \\$x;

\$y = 5;
print "\$x\n";
```
```my @x = qw(1 2 3 4);
*y = \@x;

splice @y, 2, 1, "hi";
print "@x\n";
```
```use Lexical::Alias;

...

\$y = 5;
print "\$x\n";
```
```my \$x = 0;

...
}

print "\$x\n";
```
```x + (x+b) + ... + (x+(n-1)b) = k

nx + b(1 + 2 + .. + (n-1)) = k

nx + b(n(n-1)/2) = k
```
```bn^2 + (2x-b)n - 2k = 0
```
```my \$p = UnorderedSetPartition->new(
items => ['a'..'f'],
...
## code repetition here?

\$how_many_partitions = \$p->count;
```
```sub binomial {
my (\$n, \$k) = @_;
...
}
\$c;
}
```
```use Memoize;
memoize 'int_partitions';
...
}

print int_partitions(shift), \$/;
```
```use Memoize;
memoize 'restricted_partitions';
...
}

print restricted_partitions(@ARGV), \$/;
```
```--- mysqlPP.pm.orig     2005-02-16 23:40:15.000000000 -0600
+++ mysqlPP.pm  2005-02-16 23:41:17.000000000 -0600
...
}
my \$mysql = \$sth->FETCH('mysqlpp_handle');
my \$result = eval {
```
```\$sth = \$dbh->prepare("select * from foo where id=?");
\$sth->execute( param("id") );

## execute failed: called with 0 bind variables when 1 are needed
```
```# use CGI 'param'; ## not anymore!
use CGI; sub param { scalar CGI::param(@_) }
```
```"Robert "Bob" Smith","42","FooBar"
```
```use Text::xSV;

...
}

my \$csv = Text::xSV->new( filename => "...", filter => \&filter );
```
```--- xSV-old.pm  2004-05-26 20:13:12.000000000 -0500
+++ xSV.pm      2004-05-26 20:32:48.000000000 -0500
...
);
foreach my \$accessor (@normal_accessors) {
no strict 'refs';
```

Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2021-09-25 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?