Ask a Question related to PERL Beginners, Design and Development.
-
Ajit P Singh #1
comparing array value...
Hello there,
could somebody let me know how do i compare the contents of an array that I
have...
To be specific.
my array contains something like below and i need to compare whether the
string "interface ATM2/0.10 multipoint"
exists in my array.
---------------------------------------------------
Building configuration...
Current configuration : 130 bytes
!
interface ATM2/0.10 multipoint
description config vp thru program for slot2
range pvc 10/32 10/1023
class-range dbs
!
end
----------------------------------------------------
----------------------------------------------------------------------------
----------------
regards,
Ajitpal Singh,
Ajit P Singh Guest
-
Comparing Time
I am trying to query a DB for all records that were created by one user, on one day and between two time periods. Here is my codet: <cfset... -
Comparing values
i have created three fields named (username, surname & pin) and when the user enters in the information, i want it to compare the values from three... -
Comparing 2 hashes of array refs
On 11 Jul 2003, simo wrote: It's best to cut and paste from your code, as opposed to retyping. Hashes are defined by parenthesis, not by... -
Comparing two tables
Hi, I would have to make code in C++ that would check two database tables for differencies. The two tables should be identical. If there are any... -
comparing rows in a multidimensional array
how can i compare rows (3 or more rows) in a multidiemensional array? they all contain numeric values, i need to find its similar values and unique... -
James Edward Gray II #2
Re: comparing array value...
On Feb 3, 2004, at 7:59 AM, Singh, Ajit p wrote:
How about something like this:> Hello there,
>
> could somebody let me know how do i compare the contents of an array
> that I
> have...
> To be specific.
>
> my array contains something like below and i need to compare whether
> the
> string "interface ATM2/0.10 multipoint"
> exists in my array.
>
> ---------------------------------------------------
> Building configuration...
>
> Current configuration : 130 bytes
> !
> interface ATM2/0.10 multipoint
> description config vp thru program for slot2
> range pvc 10/32 10/1023
> class-range dbs
> !
> end
> ----------------------------------------------------
if (contains("interface ATM2/0.10 multipoint", @config)) {
# do something...
}
sub contains {
my($string, @line) = @_;
foreach (@lines) { return 1 if /\Q$string/; } # return true if we
fine the string
return; # false if we don't
}
Hope that helps.
James
James Edward Gray II Guest
-
Charles K. Clarkson #3
RE: comparing array value...
Singh, Ajit p <ajit.pal.singh@thus.net> wrote:
:
: Hello there,
:
: Could somebody let me know how do I compare the
: contents of an array that I have. To be specific,
: my array contains something like below and I need
: to compare whether the string
: "interface ATM2/0.10 multipoint" exists in my
: array.
Why is this data in an array? If you are going
to search it, it would be nicer if it were in a
scalar or in a hash. How did it get in an array to
begin with?
HTH,
Charles K. Clarkson
--
Head Bottle Washer,
Clarkson Energy Homes, Inc.
Mobile Home Specialists
254 968-8328
Charles K. Clarkson Guest
-
R. Joseph Newton #4
Re: comparing array value...
"Singh, Ajit p" wrote:
Why? I see nothing uniform between the lines of the array tosuggest that they> Hello there,
>
> could somebody let me know how do i compare the contents of an array that I
> have...
> To be specific.
>
> my array contains something like below
should be handled as array elements. What you show below looks like text,
possibly a block. Is the whole block an array element? That might be a
sensible arrangement, if you have a series of blocks of similar format. If not,
then you probably need to rethink how you are loading your array.
Array operations on heterogenous data like that shown below will be exceedinbly
clumsy. If you start by defining your problem, what data you have available,
and what information you want to generate from it, we can probably help you find
more appropriate ways to process it.
> ...Joseph> Building configuration...
>
> Current configuration : 130 bytes
> !
> interface ATM2/0.10 multipoint
> description config vp thru program for slot2
> range pvc 10/32 10/1023
> class-range dbs
> !
> end
R. Joseph Newton Guest



Reply With Quote

