Created
August 15, 2013 01:49
-
-
Save sjcotto/6237544 to your computer and use it in GitHub Desktop.
perl parsers laboratorio teoria de lenguajes
This file contains 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
asfd |
This file contains 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
while (<>){ | |
my $c = 0; | |
foreach my $word (split /[^\w]+/, $_) { | |
if ($word=~/(^a(.*)a$)|(^a$)/){ | |
print $word,"\n"; | |
} | |
} | |
} | |
while (<>){ | |
print "LINEA:","\n"; | |
print "\t",$_;"\n"; | |
print "PALABRAS:","\n"; | |
my $c = 0; | |
foreach my $word (split /[^\w]+/, $_) { | |
if (length($word)>0){ | |
$c++; | |
print "\t",$word,,"\n"; | |
} | |
} | |
print "CANTIDAD:","\n"; | |
print "\t",$c,"\n"; | |
} | |
#!/usr/bin/perl | |
@a = <>; | |
$_= join("", @a); | |
while (/(^[aeiou])([^\.|;]*)(\.|;)/gism) | |
{ | |
print '"',$1,$2,$3,'"',"\n"; | |
} | |
while (<>){ | |
if (/\S* \d* \S* \S* \d* (\d*)-(\d*)-(\d*) \d*:\d* ([^\d]*\d+.*[^\/]\/)(.*)/){ | |
print; | |
my $copy = $5; | |
if ($2>6){ | |
print "2do semestre de ",$1,"\n" | |
}else{ | |
print "1er semestre de ",$1,"\n" | |
} | |
my $var = $4; | |
$var =~ s/\d/#/g; | |
print $var,"\n"; | |
print $copy,"\n"; | |
} | |
} | |
#ojo que no nos estamos asegurando que sea el directorio actual | |
#!/usr/bin/perl | |
@a = <>; | |
$_= join("", @a); | |
while (/<img .*?src="(.*?)" width="(\d*?)" height="(\d*?)"/gism) | |
{ | |
if ($2 > 99 & $3>99){ | |
print '<img src="http:',$1,'"/>',"\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment