|
From: Michele Dondi on 2 Oct 2006 13:00 On Mon, 2 Oct 2006 16:23:15 +0000 (UTC), David Williams <dw149(a)acmex.gatech.edu> wrote: >Subject: Help with Code *PLEASE* put the subject of your post in the Subject. >Hello all, >I am asking for help with the following code: > > > if($old=~/checksum=(\d+)/) Very very basic Perl syntax. It checks whether the string contained in $old contains a substring consisting of the literal string 'checksum=' followed by a positive number of digits. > I think the =~ is not equal to meaning if > $old (which is a filehandler) is not equal to something. perldoc perlop And I bet $old is *not* a filehandler^H! > also, checksum, is that a UNIX command? checksum is not a variable It's a string! > anywhere in the code I am debugging. I did a man page on checksum I think that DEBUGGING that code would require some familiarity with ELEMENTARY Perl. > Lastly, what is \d+ ? The PERL book says \d is digit but I don't > understand. Read more of it. But I doubt it is a "PERL" book. See perldoc -q difference. > Thanks for any help! HTH. Michele -- {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB=' ..'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_, 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
From: Dr.Ruud on 3 Oct 2006 07:58 Ian Wilson schreef: > \d matches "0", "1" ... "8" or "9" Last time I checked, \d matched 268 different characters. Dear programmer, if you mean [0-9], then write [0-9]. -- Affijn, Ruud "Gewoon is een tijger."
From: Paul Lalli on 3 Oct 2006 08:12 Dr.Ruud wrote: > Ian Wilson schreef: > > > \d matches "0", "1" ... "8" or "9" > > Last time I checked, \d matched 268 different characters. Dear > programmer, if you mean [0-9], then write [0-9]. Er. Huh? I realize that \w will match not only 'a'..'z', 'A'..'Z', '0'..'9', and _, and that all the "international" letters such as á and Ñ are included as well, depending on locale. But other than the ten characters Ian implied, what else does \d match? I did take a look at `perldoc perlreref`, which in turn referred me to `perldoc perllocale`, but I confess that I don't get it - I'm extremely naïve when it comes to locales... Paul Lalli
From: Dr.Ruud on 3 Oct 2006 11:18 Paul Lalli schreef: > Dr.Ruud: >> Ian Wilson: >>> \d matches "0", "1" ... "8" or "9" >> >> Last time I checked, \d matched 268 different characters. Dear >> programmer, if you mean [0-9], then write [0-9]. > > Er. Huh? I realize that \w will match not only 'a'..'z', 'A'..'Z', > '0'..'9', and _, and that all the "international" letters such as ? > and ? are included as well, depending on locale. But other than the > ten characters Ian implied, what else does \d match? > > I did take a look at `perldoc perlreref`, which in turn referred me to > `perldoc perllocale`, but I confess that I don't get it - I'm > extremely na?ve when it comes to locales... The following tries to promote Data::Alias as well: #!/usr/bin/perl # Id: unicount.pl # Subject: show some Unicode statistics use warnings ; use strict ; use Data::Alias ; binmode STDOUT, ':utf8' ; my @table = # +--Name------+---qRegexp--------+-C-+-L-+-U-+ ( [ 'xdigit' , qr/[[:xdigit:]]/ , 0 , 0 , 0 ] , [ 'ascii' , qr/[[:ascii:]]/ , 0 , 0 , 0 ] , [ '\\d' , qr/\d/ , 0 , 0 , 0 ] , [ 'digit' , qr/[[:digit:]]/ , 0 , 0 , 0 ] , [ 'IsNumber' , qr/\p{IsNumber}/ , 0 , 0 , 0 ] , [ 'alpha' , qr/[[:alpha:]]/ , 0 , 0 , 0 ] , [ 'alnum' , qr/[[:alnum:]]/ , 0 , 0 , 0 ] , [ 'word' , qr/[[:word:]]/ , 0 , 0 , 0 ] , [ 'graph' , qr/[[:graph:]]/ , 0 , 0 , 0 ] , [ 'print' , qr/[[:print:]]/ , 0 , 0 , 0 ] , [ 'blank' , qr/[[:blank:]]/ , 0 , 0 , 0 ] , [ 'space' , qr/[[:space:]]/ , 0 , 0 , 0 ] , [ 'punct' , qr/[[:punct:]]/ , 0 , 0 , 0 ] , [ 'cntrl' , qr/[[:cntrl:]]/ , 0 , 0 , 0 ] , ) ; my @codepoints = ( 0x0000 .. 0xD7FF, 0xE000 .. 0xFDCF, 0xFDF0 .. 0xFFFD, 0x10000 .. 0x1FFFD, 0x20000 .. 0x2FFFD, # 0x30000 .. 0x3FFFD, # etc. ) ; for my $row ( @table ) { alias my ($name, $qrx, $count, $lower, $upper) = @$row ; printf "\n%s\n", $name ; my $n = 0 ; for ( @codepoints ) { local $_ = chr ; # int-2-char conversion $n++ ; if ( /$qrx/ ) { $count++ ; $lower++ if / [[:lower:]] /x ; $upper++ if / [[:upper:]] /x ; } } my $show_lower_upper = ($lower || $upper) ? sprintf( ' (lower:%6d, upper:%6d)' , $lower , $upper ) : '' ; printf "%6d /%6d =%7.3f%%%s\n" , $count , $n , 100 * $count / $n , $show_lower_upper } print "\n" ; __END__ Results (v5.8.6, i386-freebsd-64int) xdigit 22 /194522 = 0.011% (lower: 6, upper: 6) ascii 128 /194522 = 0.066% (lower: 26, upper: 26) \d 268 /194522 = 0.138% digit 268 /194522 = 0.138% IsNumber 612 /194522 = 0.315% alpha 91183 /194522 = 46.875% (lower: 1380, upper: 1160) alnum 91451 /194522 = 47.013% (lower: 1380, upper: 1160) word 91801 /194522 = 47.193% (lower: 1380, upper: 1160) graph 102330 /194522 = 52.606% (lower: 1380, upper: 1160) 102349 /194522 = 52.616% (lower: 1380, upper: 1160) blank 18 /194522 = 0.009% space 24 /194522 = 0.012% punct 374 /194522 = 0.192% cntrl 6473 /194522 = 3.328% -- Affijn, Ruud "Gewoon is een tijger."
From: Peter J. Holzer on 3 Oct 2006 11:50 On 2006-10-03 12:12, Paul Lalli <mritty(a)gmail.com> wrote: > Dr.Ruud wrote: >> Ian Wilson schreef: >> >> > \d matches "0", "1" ... "8" or "9" >> >> Last time I checked, \d matched 268 different characters. Dear >> programmer, if you mean [0-9], then write [0-9]. > > Er. Huh? I realize that \w will match not only 'a'..'z', 'A'..'Z', > '0'..'9', and _, and that all the "international" letters such as á > and Ñ are included as well, depending on locale. But other than the > ten characters Ian implied, what else does \d match? The digits in all the non-latin scripts. Try: #!/usr/bin/perl use warnings; use strict; use charnames qw(); for my $c (0x0000 .. 0xD7FF, 0xE000 .. 0xFDCF, 0xFDF0 .. 0xFFFD, 0x1_0000 .. 11_0000 ) { my $s = pack 'U', $c; if ($s =~ /\d/) { printf ("%5d %5x %s %s\n", $c, $c, $s, charnames::viacode($c)); } } On my system this prints 218 digits: 48 30 0 DIGIT ZERO 49 31 1 DIGIT ONE 50 32 2 DIGIT TWO 51 33 3 DIGIT THREE 52 34 4 DIGIT FOUR 53 35 5 DIGIT FIVE 54 36 6 DIGIT SIX 55 37 7 DIGIT SEVEN 56 38 8 DIGIT EIGHT 57 39 9 DIGIT NINE 1632 660 ? ARABIC-INDIC DIGIT ZERO 1633 661 ? ARABIC-INDIC DIGIT ONE 1634 662 ? ARABIC-INDIC DIGIT TWO 1635 663 ? ARABIC-INDIC DIGIT THREE 1636 664 ? ARABIC-INDIC DIGIT FOUR 1637 665 ? ARABIC-INDIC DIGIT FIVE 1638 666 ? ARABIC-INDIC DIGIT SIX 1639 667 ? ARABIC-INDIC DIGIT SEVEN 1640 668 ? ARABIC-INDIC DIGIT EIGHT 1641 669 ? ARABIC-INDIC DIGIT NINE 1776 6f0 ? EXTENDED ARABIC-INDIC DIGIT ZERO 1777 6f1 ? EXTENDED ARABIC-INDIC DIGIT ONE 1778 6f2 ? EXTENDED ARABIC-INDIC DIGIT TWO 1779 6f3 ? EXTENDED ARABIC-INDIC DIGIT THREE 1780 6f4 ? EXTENDED ARABIC-INDIC DIGIT FOUR 1781 6f5 ? EXTENDED ARABIC-INDIC DIGIT FIVE 1782 6f6 ? EXTENDED ARABIC-INDIC DIGIT SIX 1783 6f7 ? EXTENDED ARABIC-INDIC DIGIT SEVEN 1784 6f8 ? EXTENDED ARABIC-INDIC DIGIT EIGHT 1785 6f9 ? EXTENDED ARABIC-INDIC DIGIT NINE 2406 966 ? DEVANAGARI DIGIT ZERO 2407 967 ? DEVANAGARI DIGIT ONE 2408 968 ? DEVANAGARI DIGIT TWO 2409 969 ? DEVANAGARI DIGIT THREE 2410 96a ? DEVANAGARI DIGIT FOUR 2411 96b ? DEVANAGARI DIGIT FIVE 2412 96c ? DEVANAGARI DIGIT SIX 2413 96d ? DEVANAGARI DIGIT SEVEN 2414 96e ? DEVANAGARI DIGIT EIGHT 2415 96f ? DEVANAGARI DIGIT NINE 2534 9e6 ? BENGALI DIGIT ZERO 2535 9e7 ? BENGALI DIGIT ONE 2536 9e8 ? BENGALI DIGIT TWO 2537 9e9 ? BENGALI DIGIT THREE 2538 9ea ? BENGALI DIGIT FOUR 2539 9eb ? BENGALI DIGIT FIVE 2540 9ec ? BENGALI DIGIT SIX 2541 9ed ? BENGALI DIGIT SEVEN 2542 9ee ? BENGALI DIGIT EIGHT 2543 9ef ? BENGALI DIGIT NINE 2662 a66 ? GURMUKHI DIGIT ZERO 2663 a67 ? GURMUKHI DIGIT ONE 2664 a68 ? GURMUKHI DIGIT TWO 2665 a69 ? GURMUKHI DIGIT THREE 2666 a6a ? GURMUKHI DIGIT FOUR 2667 a6b ? GURMUKHI DIGIT FIVE 2668 a6c ? GURMUKHI DIGIT SIX 2669 a6d ? GURMUKHI DIGIT SEVEN 2670 a6e ? GURMUKHI DIGIT EIGHT 2671 a6f ? GURMUKHI DIGIT NINE 2790 ae6 ? GUJARATI DIGIT ZERO 2791 ae7 ? GUJARATI DIGIT ONE 2792 ae8 ? GUJARATI DIGIT TWO 2793 ae9 ? GUJARATI DIGIT THREE 2794 aea ? GUJARATI DIGIT FOUR 2795 aeb ? GUJARATI DIGIT FIVE 2796 aec ? GUJARATI DIGIT SIX 2797 aed ? GUJARATI DIGIT SEVEN 2798 aee ? GUJARATI DIGIT EIGHT 2799 aef ? GUJARATI DIGIT NINE 2918 b66 ? ORIYA DIGIT ZERO 2919 b67 ? ORIYA DIGIT ONE 2920 b68 ? ORIYA DIGIT TWO 2921 b69 ? ORIYA DIGIT THREE 2922 b6a ? ORIYA DIGIT FOUR 2923 b6b ? ORIYA DIGIT FIVE 2924 b6c ? ORIYA DIGIT SIX 2925 b6d ? ORIYA DIGIT SEVEN 2926 b6e ? ORIYA DIGIT EIGHT 2927 b6f ? ORIYA DIGIT NINE 3047 be7 ? TAMIL DIGIT ONE 3048 be8 ? TAMIL DIGIT TWO 3049 be9 ? TAMIL DIGIT THREE 3050 bea ? TAMIL DIGIT FOUR 3051 beb ? TAMIL DIGIT FIVE 3052 bec ? TAMIL DIGIT SIX 3053 bed ? TAMIL DIGIT SEVEN 3054 bee ? TAMIL DIGIT EIGHT 3055 bef ? TAMIL DIGIT NINE 3174 c66 ? TELUGU DIGIT ZERO 3175 c67 ? TELUGU DIGIT ONE 3176 c68 ? TELUGU DIGIT TWO 3177 c69 ? TELUGU DIGIT THREE 3178 c6a ? TELUGU DIGIT FOUR 3179 c6b ? TELUGU DIGIT FIVE 3180 c6c ? TELUGU DIGIT SIX 3181 c6d ? TELUGU DIGIT SEVEN 3182 c6e ? TELUGU DIGIT EIGHT 3183 c6f ? TELUGU DIGIT NINE 3302 ce6 ? KANNADA DIGIT ZERO 3303 ce7 ? KANNADA DIGIT ONE 3304 ce8 ? KANNADA DIGIT TWO 3305 ce9 ? KANNADA DIGIT THREE 3306 cea ? KANNADA DIGIT FOUR 3307 ceb ? KANNADA DIGIT FIVE 3308 cec ? KANNADA DIGIT SIX 3309 ced ? KANNADA DIGIT SEVEN 3310 cee ? KANNADA DIGIT EIGHT 3311 cef ? KANNADA DIGIT NINE 3430 d66 ? MALAYALAM DIGIT ZERO 3431 d67 ? MALAYALAM DIGIT ONE 3432 d68 ? MALAYALAM DIGIT TWO 3433 d69 ? MALAYALAM DIGIT THREE 3434 d6a ? MALAYALAM DIGIT FOUR 3435 d6b ? MALAYALAM DIGIT FIVE 3436 d6c ? MALAYALAM DIGIT SIX 3437 d6d ? MALAYALAM DIGIT SEVEN 3438 d6e ? MALAYALAM DIGIT EIGHT 3439 d6f ? MALAYALAM DIGIT NINE 3664 e50 ? THAI DIGIT ZERO 3665 e51 ? THAI DIGIT ONE 3666 e52 ? THAI DIGIT TWO 3667 e53 ? THAI DIGIT THREE 3668 e54 ? THAI DIGIT FOUR 3669 e55 ? THAI DIGIT FIVE 3670 e56 ? THAI DIGIT SIX 3671 e57 ? THAI DIGIT SEVEN 3672 e58 ? THAI DIGIT EIGHT 3673 e59 ? THAI DIGIT NINE 3792 ed0 ? LAO DIGIT ZERO 3793 ed1 ? LAO DIGIT ONE 3794 ed2 ? LAO DIGIT TWO 3795 ed3 ? LAO DIGIT THREE 3796 ed4 ? LAO DIGIT FOUR 3797 ed5 ? LAO DIGIT FIVE 3798 ed6 ? LAO DIGIT SIX 3799 ed7 ? LAO DIGIT SEVEN 3800 ed8 ? LAO DIGIT EIGHT 3801 ed9 ? LAO DIGIT NINE 3872 f20 ? TIBETAN DIGIT ZERO 3873 f21 ? TIBETAN DIGIT ONE 3874 f22 ? TIBETAN DIGIT TWO 3875 f23 ? TIBETAN DIGIT THREE 3876 f24 ? TIBETAN DIGIT FOUR 3877 f25 ? TIBETAN DIGIT FIVE 3878 f26 ? TIBETAN DIGIT SIX 3879 f27 ? TIBETAN DIGIT SEVEN 3880 f28 ? TIBETAN DIGIT EIGHT 3881 f29 ? TIBETAN DIGIT NINE 4160 1040 ? MYANMAR DIGIT ZERO 4161 1041 ? MYANMAR DIGIT ONE 4162 1042 ? MYANMAR DIGIT TWO 4163 1043 ? MYANMAR DIGIT THREE 4164 1044 ? MYANMAR DIGIT FOUR 4165 1045 ? MYANMAR DIGIT FIVE 4166 1046 ? MYANMAR DIGIT SIX 4167 1047 ? MYANMAR DIGIT SEVEN 4168 1048 ? MYANMAR DIGIT EIGHT 4169 1049 ? MYANMAR DIGIT NINE 4969 1369 ? ETHIOPIC DIGIT ONE 4970 136a ? ETHIOPIC DIGIT TWO 4971 136b ?
First
|
Prev
|
Next
|
Last
Pages: 1 2 3 Prev: matching date Next: XML::Parser Installation error: XML-Parser-2.34 |