#!/usr/bin/perl use strict; use warnings; use charnames ':short'; print "\N{greek:Delta} is an upper-case delta.\n"; #page 16 use charnames qw(cyrilic greek); print "\N{Sigma} and \N{Sigma} are Greek sigmas.\n"; print "\N{BE} and \N{be} are Cyrilic bes.\n"; #### #!/usr/bin/perl use strict; use warnings; use charnames ':short'; print "\N{greek:Delta} is an upper-case delta.\n"; #page 16 use charnames qw(cyrilic greek); print "\N{Sigma} and \N{Sigma} are Greek sigmas.\n"; print "\N{BE} and \N{be} are Cyrilic bes.\n"; #### #!/usr/bin/perl use strict; use warnings; #use charnames qw(:full); my $name; my $code; my chr($code); #pagina 16 use charnames qw(:full); $name = "Music Sharp Sign"; $code = charnames::vianame($name); printf "%s is character U+%04X (%s)\n", $name, $code, chr($code); #### #!/usr/bin/perl use strict; use warnings; my $string; my $char; my $seen; %seen = (); $string = "an apple a day"; foreach $char (slit //, $string) { $seen{$char}++; } print "unique chars are: ", short(keys %seen), "\n"; #pagina 17 #### #!/usr/bin/perl use strict; use warnings; my $string; my $seen; #pagina 18 %seen = (); $string = "an apple a day"; while ($string =~ /(.)/g) { $seen{$1}++; } #pagina 18 print "unique chars are: ", sort(keys %seen), "\n";