Darren Birkett wrote:
I just want to match certain keyword(s) to determine device type.
I guess a for loop is the closest I'm going to get.  I just thought
there would be a specific function for this.

Isn't grep() "specific" enough?

Initially you said:

    $line = join(' ',@myarray);
    if ($line =~ /my string/) {
        some code
    }

The equivalent using grep() would be:

    if ( grep /my string/, @myarray ) {
        some code
    }

So then I wonder - which is more efficient.  My earlier "join"
example, or a for loop?

To get the answer to such a question, do a benchmark with help of the Benchmark module.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to