- or download this
# typical hash-of-hashes:
my %hash = ( a => { b => 2 },
c => { b => 4 } );
$hash{$key1}{$key2} = $value;
- or download this
while ( my ( $outer_key, $outer_value ) = each %hash )
{
...
# do whatever...
}
}
- or download this
# with dups
my @inner_keys = map { keys %$_ } values %hash;
...
}
keys %inner_keys;
};
- or download this
perl -lwe 'sub f { my $n = shift;
return $n < 2 ? 1 : $n * f($n-1); }
print f(7);
eval { print f(8); };
if ( $@ ) { print "eval failed: $@" }'
- or download this
#!/bin/bash -x
...
next=mutated$(( $i + 1 )).plx
cp $this $next
done;
- or download this
./mutated1.plx: eval: line 1: unexpected EOF while looking for matchin
+g `"'
./mutated1.plx: eval: line 2: syntax error: unexpected end of file
./mutated1.plx: line 4: syntax error near unexpected token `.'
./mutated1.plx: line 4: `('`'|'-').('['^'"').('{'^'[').'\\$'.('`'|'-')
+.('['^'#').('{'^'[').'='.('{'^'[').('^'^('`'|')')).('^'^('`'|'.')).('
+^'^('`''
- or download this
cmd1 arg1 arg2 arg3 && \
cmd2 arg arg arg pirate arg arg arg
- or download this
foreach d in $( find . -type d -depth 1 -print )
do
tar czf $d.tar.gz $d && \
rm -rf $d
done
- or download this
$ perl -lwe '$_="[http://a|alpha] [http://b|beta]";
print;
...
print'
[http://a|alpha] [http://b|beta]
<a href="http://a">alpha</a> <a href="http://b">beta</a>
- or download this
$ perl -lwe '$_="[http://a|alpha] [http://b|beta] [http://g]";
print;
...
<a href="http://a">alpha</a>
<a href="http://b">beta</a>
<a href="http://g">http://g</a>
- or download this
$ perl -lwe \
'$_="[http://a|alpha] [http://b|beta] [http://g]";
...
<a href="http://a">alpha</a>
<a href="http://b">beta</a>
<a href="http://g">http://g</a>
- or download this
my $x = join("", 0..9)x2;
my $lx = length($x);
my $next_mult = ($lx + 15) & ~0x0f;
$x .= "*" x ($next_mult - $lx);
print "|$x|\n"'
- or download this
=item $self->add_manufacturer( %args );
...
# still need to get actual new id here...
return $self->{dbh}->get_latest_insert_id();
}
- or download this
=item my $prefix = shortest_prefix @strings;
...
return $prefix;
}
- or download this
SELECT *
FROM my_table AS t,
( SELECT MAX( date ) AS max_date
FROM my_table ) AS s
WHERE t.date = s.max_date;
- or download this
#include <limits>
int max_int = std::numeric_limits<int>::max();
- or download this
href="...&session=<TMPL_VAR ESCAPE="HTML" NAME="session">&mod=<TMPL_
+VAR ESCAPE="HTML" NAME="mod">&..."
- or download this
<tr <TMPL_IF NAME="__odd__">
bgcolor="<TMPL_VAR NAME="odd_color" ESCAPE="HTML">"
<TMPL_ELSE>
bgcolor="<TMPL_VAR NAME="even_color" ESCAPE="HTML">"
</TMPL_IF> >