Re: how to construct regex to count no. of alphabets in a scalar variable

2008-04-13 Thread Chas. Owens
On Sun, Apr 13, 2008 at 12:05 PM, John W. Krahn <[EMAIL PROTECTED]> wrote: snip > > In scalar context it returns true if it matches at all and in list > > context it returns a list of matches. Now, normally a list in scalar > > context returns the last element of the list, > > > > That is the com

Re: how to construct regex to count no. of alphabets in a scalar variable

2008-04-13 Thread John W. Krahn
Chas. Owens wrote: On Sun, Apr 13, 2008 at 4:03 AM, <[EMAIL PROTECTED]> wrote: my $count = () = $str =~ /a/g; Thanks Chas. Owens, I need some explanation on the above on how the above regex count the number of 'a' in a string. With my limited understanding, this is what I thought:- $coun

Re: how to construct regex to count no. of alphabets in a scalar variable

2008-04-13 Thread Chas. Owens
On Sun, Apr 13, 2008 at 4:03 AM, <[EMAIL PROTECTED]> wrote: > > > my $count = () = $str =~ /a/g; > > > Thanks Chas. Owens, > I need some explanation on the above on how the above regex count the > number of 'a' in a string. > > With my limited understanding, this is what I thought:- > $count =

Re: how to construct regex to count no. of alphabets in a scalar variable

2008-04-13 Thread itshardtogetone
PROTECTED]> Cc: Sent: Sunday, April 13, 2008 12:40 PM Subject: Re: how to construct regex to count no. of alphabets in a scalar variable On Sun, Apr 13, 2008 at 12:35 AM, <[EMAIL PROTECTED]> wrote: Hi, How do I construct a regex to count the number of 'a' within a scalar va

Re: how to construct regex to count no. of alphabets in a scalar variable

2008-04-12 Thread Chas. Owens
On Sun, Apr 13, 2008 at 12:35 AM, <[EMAIL PROTECTED]> wrote: > Hi, > How do I construct a regex to count the number of 'a' within a scalar > variable such as the undermentioned. > One method I can think of is to split the scalar string into a list and then > do the counting but I just feel tha