Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Using grep in a scalar context

by tobyink (Abbot)
on Feb 06, 2013 at 13:49 UTC ( #1017437=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use v5.12;
    use List::Util qw(sum);
    ...
    my @dipept = qw( AABBCC AABBAA );
    my $count  = sum map { scalar(my @r = /AA/g) } @dipept;
    say $count;
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1017437]
help
Chatterbox?
[stevieb]: I literally laughed. That's good :) Perhaps I just need to go climb another mountain and forget about it
shmem seeks a tate and smikes a pope
shmem .oO( Ca n'est pas un pipe )

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2017-03-28 22:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (342 votes). Check out past polls.