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 ----------------------------------------------------
How about something like this:
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
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>