View Single Post

  #2 (permalink)  
Old 02-11-2008, 03:26 PM
agn agn is offline
Member
User
 
Join Date: Feb 2008
My distro: OpenBSD/FreeBSD/Debian/Fedora/RHEL
Posts: 69
Rep Power: 1
agn is on a distinguished road
Default

Code:
#!/usr/bin/perl

#use strict;
use warnings;

sub search_pattern
{
    my ($file_name, @search) = @_;
    open(LOGFILE, $_[0]) or die("Error: cannot open file '$_[0]'\n");
    while (<LOGFILE>) {
        foreach $pattern (@search) {
        if ( $_ =~ /$search/ ) {
Is this what you want ?

Last edited by agn; 02-12-2008 at 12:13 PM..
Reply With Quote