in this code what is the
$n =~ /$b/i;
On Fri, Dec 30, 2011 at 11:53 AM, John Riselvato wrote:
> in this code what is the
> $n =~ /$b/i;
>
>
> On Fri, Dec 30, 2011 at 10:51 AM, Igor Dovgiy wrote:
>
>> Oh my, of course it should be...
>> my @repeated = grep { /some regex here/ && ++$seen{$_} > N }
Oh my, of course it should be...
my @repeated = grep { /some regex here/ && ++$seen{$_} > N } @source_array;
... to work properly.
-- iD
2011/12/30 Igor Dovgiy
> Hi Xi,
>
> You're looking only for 'p' letters, not D and O? Why?
>
> Anyway, generic solution will be something like...
>
> my %see
Hi Xi,
You're looking only for 'p' letters, not D and O? Why?
Anyway, generic solution will be something like...
my %seen;
my @repeated = grep { /some regex here/ && $seen{$_} > N } @source_array;
... where N is how many times the symbols should appear in the source array
to be counted as dupl
Yes, I agree the code looks strange. Do you have any idea to do this
with a clear code? I mean to find two same letters, "p" in @a?
Xi
On Thu, Dec 29, 2011 at 10:17 PM, John W. Krahn wrote:
> Xi Chen wrote:
>>
>> Hello everyone,
>>
>> I saw a code below to get two same letters "p" in @a.
>>
>> @
Xi Chen wrote:
Hello everyone,
I saw a code below to get two same letters "p" in @a.
@a = qw (D D p O H p A O);
foreach $b (@a){
$n =~ /$b/i;
if($n>= 2){
$m = $b;
}
}
But I don't know what does ">=" mean. Thank you!
It means "greater than or equal to". The expression "$n >= 2" is
On Thu, Dec 29, 2011 at 9:26 PM, Xi Chen wrote:
> Hello everyone,
>
> I saw a code below to get two same letters "p" in @a.
>
> @a = qw (D D p O H p A O);
> foreach $b (@a){
> $n =~ /$b/i;
> if($n >= 2){
> $m = $b;
> }
> }
>
> But I don't know what does ">=" mean. Thank you!
>
It is just g
Hello everyone,
I saw a code below to get two same letters "p" in @a.
@a = qw (D D p O H p A O);
foreach $b (@a){
$n =~ /$b/i;
if($n >= 2){
$m = $b;
}
}
But I don't know what does ">=" mean. Thank you!
Xi
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional command