$, @, %
#!/usr/local/bin/perl -w
while (<>) {
if ($_ =~ /Gertjan/) {
print "yes\n";
} else {
print "no\n";
}
}
<>
#!/usr/local/bin/perl -w
while (<>) {
if (/Gertjan/) {
print "yes\n";
} else {
print "no\n";
}
}
#!/usr/local/bin/perl -w
while (<>) {
if (/[gG]ert-?[jJ]an/) {
print "yes\n";
} else {
print "no\n";
}
}
% perldoc -f chr =item chr NUMBER =item chr Returns the character represented by that NUMBER in the character set. For example, Cis "A" in ASCII. For the reverse, use L. If NUMBER is omitted, uses $_.
#!/usr/local/bin/perl -w
$i=0;
while ($i<256) {
$char=chr($i);
print "$i: $char\n";
++$i;
}
#!/usr/local/bin/perl -w
while (<>) {
chop;
y/A-Z/a-z/;
$dict{$_}=1;
}
foreach $word (keys %dict) {
chomp $word;
if ( exists($dict{reverse($word)."\n"}) ) {
print "$word\n";
}
}
#!/usr/local/bin/perl -w
while (<>) {
chop;
y/A-Z/a-z/;
$dict{$_}=1;
}
foreach $word (keys %dict) {
if (carousel($word)) {
print "$word\n";
}
}
sub carousel {
$i=0;
($string) = @_;
while ($i < length($string)-1) {
$string = chop($string).$string;
$i++;
if (! $dict{$string}) {
return 0;
}
}
return 1;
}
#!/usr/local/bin/perl -w
use Getopt::Std;
getopts('cw');
if ($opt_w) {
while (<>) {
chop;
@ma = ($_ =~ /\w+/g);
print scalar(@ma),"\t$_\n";
}
} else {
while (<>) {
chop;
print length,"\t$_\n";
}
}
NB. Library modules hebben documentatie! Zie: man Getopt::Std
#!/usr/local/bin/perl -w
while (<>) {
chomp;
push(@{$idict{join('',sort(split //))}},$_);
}
foreach $word (keys %idict) {
if (@{$idict{$word}} > 1) {
print join (" ",@{$idict{$word}}),"\n";
}
}
Op 1 april 1977 verscheen in het Cultureel Supplement van de NRC een rapportage over een op handen zijnde spellingshervorming. In het stuk (geschreven door Rudy Kousbroek, met zogenaamde reacties van allerlei personen van de hand van Adriaan van Dis) wordt een zeer rigoreuze spellingsverandering voorgesteld: er blijven slechts dertien letters over!: a, e, f, h, k, l, m, p, r, s, t u en y. Hieronder volgt een overzicht hoe deze letters de overige letters overbodig maken, en enkele andere veranderingen
Zie: Rudy Kousbroek, De logologische ruimte: opstellen over taal, blz 37-46.