shawnhcorey has asked for the wisdom of the Perl Monks concerning the following question:
Output:#!/usr/bin/env perl use strict; use warnings; show( 'Resume' ); show( 'Résumé' ); sub show { my $s = shift @_; print "The string is: '$s'\n\t"; for ( split //, $s ){ printf "%02X ", ord( $_ ); } print "\n\n"; my $t = uc( $s ); print "\tUppercase: '$t'\n"; $t = lc( $t ); print "\tLowercase: '$t'\n"; printf "\tlength = %d\n", length( $s ); { use bytes; printf "\tbytes = %d\n", length( $s ); } print "\n"; } __END__
I needed to know the number of characters, the number of bytes, and how to convert to uppercase and lowercase. Version:The string is: 'Resume' 52 65 73 75 6D 65 Uppercase: 'RESUME' Lowercase: 'resume' length = 6 bytes = 6 The string is: 'Résumé' 52 C3 A9 73 75 6D C3 A9 Uppercase: 'RéSUMé' Lowercase: 'résumé' length = 8 bytes = 8
$ perl -v This is perl, v5.10.0 built for ppc-linux Copyright 1987-2007, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help with Accented Characters
by ysth (Canon) on Feb 24, 2008 at 21:44 UTC | |
by shawnhcorey (Friar) on Feb 24, 2008 at 23:27 UTC | |
by ysth (Canon) on Feb 25, 2008 at 01:30 UTC | |
| |
by almut (Canon) on Feb 25, 2008 at 03:13 UTC | |
by Anonymous Monk on Feb 10, 2012 at 15:39 UTC | |
| |
by John M. Dlugosz (Monsignor) on Feb 25, 2008 at 03:12 UTC | |
|
Re: Help with Accented Characters
by Anonymous Monk on Feb 26, 2008 at 18:29 UTC |