Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Count Quoted Words

by smls (Friar)
on Jun 07, 2013 at 03:51 UTC ( #1037567=note: print w/replies, xml ) Need Help??


in reply to Count Quoted Words

Given an array @words like shown in the question, you could do:
my $count; foreach (@words) { my $quote = ($_ eq '"'); if ($quote ... $quote) { if (!$quote) { $count++ } elsif ($count) { print "$count quoted words\n"; $count = 0 } } }
Although I admit that the ... operator is slighty obscure... :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1037567]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2021-04-23 16:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?