in reply to Re: Grep Pattern Match
in thread Grep Pattern Match

Thank you... Your nudge got me in the right direction. here is the code I am using: @files = grep {/^nc$digyear$digmon.*\.log$/} @files; Works like a charm :)

-----------------------
Billy S.
Slinar Hardtail - Hand of Dane
Datal Ephialtes - Guildless
RallosZek.Net Admin/WebMaster

perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'

Replies are listed 'Best First'.
Re^3: Grep Pattern Match
by diotalevi (Canon) on Dec 27, 2002 at 16:02 UTC

      Slightly dangerous if the application calls for using the regex in a loop where one of the variables (eg. $month) changes, as unless the qr// is also inside the loop (in which case the optimisation benefits are lost), as the changing value of the variable won't be recognised.


      Examine what is said, not who speaks.

        I am not really going for optimisation (yet)... just want a script that will parse my log files that will search for attempted DOS's and stuff and then take those IP's and add them to our deny list. That is all I am writing this for.

        -----------------------
        Billy S.
        Slinar Hardtail - Hand of Dane
        Datal Ephialtes - Guildless
        RallosZek.Net Admin/WebMaster

        perl -e '$cat = "cat"; if ($cat =~ /\143\x61\x74/) { print "Its a cat! +\n"; } else { print "Thats a dog\n"; } print "\n";'