Yoda_Oz has asked for the wisdom of the Perl Monks concerning the following question:
#!usr/local/bin/perl print ("Enter filename to search to punctuation characters: "); $path=<STDIN>; print ("\n"); open(DATA, "<$path") || die "Couldn't open $path for reading: $!\n"; while (<DATA>) { while (s/([\041-\057]|[\72-\100]|[\133-\140]|[\173-\176])(.*)/$2/) + #ASCII octet punctuation + #characters { $char = $1; $wordHash{$char}++; } while ( ($punctuation, $count) = each(%wordHash) ) { $wordArray[$i] = "$punctuation\t$count"; $i++; print ("$punctuation\t$count\n"); } }
please help... <EDIT> sorted it, sorry. i had the second while loop within the first. when i put it outside of the 1st loop it worked! </EDIT>/ 3 # 1 ! 1 / 3 # 1 ! 1 / 3 : 1 # 1 " 2 ) 1 ( 1 ; 1 ! 1 $ 1 / 3 = 1 : 1 # 1 > 1 " 2 ) 1 < 1 ( 1 ; 2 ! 1 $ 1 \ 1 / 3 = 1 : 1 # 1 > 1 " 4 ) 2 < 1 ( 2 ; 3 ! 1 $ 4 \ 2 / 3 | 2 = 1 : 2 # 1 , 1 > 1 " 8 ) 3 ' 1 < 2 ( 3 ; 4 ! 2 $ 4 \ 2 / 3 | 2 = 1 : 2 # 1 , 1 > 2 " 8 ) 4 ' 1 < 3 ( 4 ; 4 ! 2 $ 4 \ 2 / 3 = 1 : 2 , 1 " 8 < 3 ; 4 ! 2 | 2 { 1 # 1 > 2 ) 4 ' 1 ( 4 $ 5 \ 10 / 6 = 1 : 2 * 1 , 1 - 4 " 8 . 1 [ 4 < 3 ; 4 ! 2 ] 4 | 5 { 1 # 1 > 2 ) 7 ' 1 ( 7 $ 5 \ 10 / 6 = 1 : 2 * 1 , 1 - 4 " 8 . 1 [ 4 < 3 ; 4 ! 2 ] 4 | 5 { 2 # 1 > 2 ) 7 ' 1 ( 7 $ 7 \ 10 / 6 = 2 : 2 * 1 , 1 - 4 " 8 . 1 [ 4 < 3 ; 5 ! 2 ] 4 | 5 { 2 # 1 > 2 ) 7 ' 1 ( 7 $ 9 \ 10 / 6 = 2 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 % 1 # 1 > 2 + 4 ) 11 ' 1 } 4 ( 11
20060130 Janitored by Corion: Added readmore tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: punctuation search... using ascii
by bobf (Monsignor) on Jan 30, 2006 at 02:57 UTC | |
|
Re: punctuation search... using ascii
by Errto (Vicar) on Jan 30, 2006 at 02:53 UTC | |
|
Re: punctuation search... using ascii
by GrandFather (Saint) on Jan 30, 2006 at 02:46 UTC | |
|
Re: punctuation search... using ascii
by japhy (Canon) on Jan 30, 2006 at 02:48 UTC | |
|
Re: punctuation search... using ascii
by McDarren (Abbot) on Jan 30, 2006 at 02:40 UTC | |
|
Re: punctuation search... using ascii
by rhesa (Vicar) on Jan 30, 2006 at 02:55 UTC |