Jim Canon wrote:
>
> On 1/14/07, John W. Krahn <[EMAIL PROTECTED]> wrote:
>>
>> Jim Canon wrote:
>> >
>> > Thank you very much for the response, it has helped me begin to
>> > understand how regular expressions work. I see that /(\d+)$/
>> > matches the numbers until the end of line in
>> >
>> >
By numbers in front I am referring to word1 word2 job2006
in the element:
word1 word2 job2006 three four five six community job555
It seems that /(\d+)$/ matches word1 word2 job2006 job555
I was reviewing http://perldoc.perl.org/perlre.html but am having trouble
determining the best way to match j
Jim Canon wrote:
>
> Thank you very much for the response, it has helped me begin to understand
> how regular expressions work. I see that /(\d+)$/ matches the numbers
> until the end of line in
>
> @job1 = qw(
> job555
> job572
> job8433
> job873
> job594
> job4663
> job2221
> job2223
>
Jim Canon wrote:
> Hi,
>
> This is my first question, I appreciate any information you provide. I want
> to compare the numbers after : in @jn to the numbers after job in @job1 and
> @job2.
>
>
> @jn =
> JN.2007:555
> JN.2007:8433
> JN.2007:594
> JN.2007:111
> JN.2007:4663
> JN.2007.321
> JN.2007:
Jim Canon wrote:
> Hi,
Hello,
> This is my first question, I appreciate any information you provide. I want
> to compare the numbers after : in @jn to the numbers after job in @job1 and
> @job2.
>
> [ snip ]
>
> I want to put what is missing in @jn compared to @job1 and @job2 in
> @jobMissing :
Hi,
This is my first question, I appreciate any information you provide. I want
to compare the numbers after : in @jn to the numbers after job in @job1 and
@job2.
@jn =
JN.2007:555
JN.2007:8433
JN.2007:594
JN.2007:111
JN.2007:4663
JN.2007.321
JN.2007:2221
@job1 =
job555
job572
job8433
job873
Paul Archer wrote:
>
> 3:20pm, Ramprasad wrote:
> >
> > Rafaqat Ali Chaudhry wrote:
> > >
> > > The array has at least 20K elements. This piece of code is taking up
> > > almost 100% of the CUP cycles. Would somebody please suggest some
> > > alternative solution.
> >
> > You can improve the code
In addition to the suggestions already given, you could sort your array, and
then look at the middle and cut it in half (potentially several times). I
forget the name for this technique, though...
For example, you have 1000 elements, sorted. You compare your number to the
500th element. If it's hi
On Jul 29, Bob Showalter said:
>Bob Showalter wrote:
>> ...
>> A more efficient iterative approach using a numeric equality test
>> would be:
>>
>>sub checkNumber {
>> $_[0] == $_ && return 1 for @numbers;
>> return;
>>}
>>
>> This returns 1 for a match and undef for no match.
Bob Showalter wrote:
> ...
> A more efficient iterative approach using a numeric equality test
> would be:
>
>sub checkNumber {
> $_[0] == $_ && return 1 for @numbers;
> return;
>}
>
> This returns 1 for a match and undef for no match.
Heck, you can even leave off the last "
Rafaqat Ali Chaudhry wrote:
> Dear all,
>
> I've a function which searches a given number from an array and
> returns the result.
>
> Function:
>
> 1.sub checkNumber($)
> 2.{
> 3.my ($l_number) = @_;
> 4.my $l_status;
> 5.my @matches= grep { /$l_numbe
Rafaqat Ali Chaudhry wrote:
Dear all,
I've a function which searches a given number from an array and returns
the result.
Function:
1. sub checkNumber($)
2. {
3. my ($l_number) = @_;
4. my $l_status;
5. my @matches= grep { /$l_number/ } @numbers;
Dear all,
I've a function which searches a given number from an array and returns
the result.
Function:
1. sub checkNumber($)
2. {
3. my ($l_number) = @_;
4. my $l_status;
5. my @matches= grep { /$l_number/ } @numbers;
6. if (@match
Thanks George.
It reduced the total time to almost 50%.
Rafaqat Ali Chaudhary
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of George P.
Sent: Tuesday, July 29, 2003 11:57
To: Rafaqat Ali Chaudhary
Cc: [EMAIL PROTECTED]
Subject: Re: Very slow array
On Tue, 29 Jul 2003, Rafaqat Ali Chaudhary wrote:
> Dear all,
>
> I've a function which searches a given number from an array and returns
> the result.
>
> Function:
>
> 1.sub checkNumber($)
> 2.{
> 3.my ($l_number) = @_;
> 4.my $l_status;
> 5.my @ma
Dear all,
I've a function which searches a given number from an array and returns
the result.
Function:
1. sub checkNumber($)
2. {
3. my ($l_number) = @_;
4. my $l_status;
5. my @matches= grep { /$l_number/ } @numbers;
6. if (@match
16 matches
Mail list logo