Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re^3: Deleting a matching string in an array

by Cristoforo (Curate)
on Oct 30, 2007 at 20:48 UTC ( [id://648106]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Deleting a matching string in an array
in thread Deleting a matching string in an array

Why not use grep as Moritz pointed out? If you loaded the robot file into the @robots array, you would need to remove the newlines like chomp(@robots) before you used it in the grep. Your date string could be stated like:
my ($day, $month, $year) = (localtime)[3..5]; # $date is YYMMDD format - you may want $day - 1? my $date = sprintf "%02d%02d%02d", $year % 100, $month + 1, $day; my $log_file_path = '/dt00mx84/LogArchive/www.ksdot.org/dt00mh77/'; my $log_file = $log_file_path . 'ex' . $date. '.log'; my $out_file = $log_file_path . $date. '.log';

Chris

Update: Not_a_Number nailed it. Didn't think about day-1 being yesterday.

Replies are listed 'Best First'.
Re^4: Deleting a matching string in an array
by Shamaeso (Initiate) on Oct 30, 2007 at 21:10 UTC

    I kept getting an error: Nested quantifiers in regex; marked by <-- HERE in m/#Software: Microsoft Internet Information Services 6.0

    I figured I would get it to remove one of the filters and not get the error then move ahead from there.

    Being new to using PERL for this stuff I figured to get the code working and improve on it from there.

    I am going to use these suggestions and get it working but the ugly fix I came up with satisfies my supervisor.

      That probably means that one (or more) of your robot identifier strings contain *+ or another illegal combination of *+?{...}.

      If you look at my original posting you'll see that it maps the strings through quotemeta, which escapes those characters, making them safe to use in a regex.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://648106]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 05:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found