Hi,

some time ago I asked for some help to eliminate certain lines from a file. Someone suggested a solution with
{ local ( $^I, @ARGV ) = ( '', <*.log> );


now when I run this I get the error "Can't do inplace edit without backup at lexmorf_ruisweg2.pl line 12."

So I'm not sure that I understand what $^I does (I read about the -i switch), and I'm rather sure I don't understand what assigning <*.log> to @ARGV does. If I get it right, the <> later on reads from <*.log>, but don't I have to open the files in some way first?

Here's my code so far:

#! C:\Program Files\Perl\bin perl

use strict;
use warnings;

{ local ( $^I, @ARGV ) = ( '', <*.log> ); 

        while ( <> ) {
                s{\[\d+/\d+/\d+\s\d+:\d+\]\s}{}; #remove timestamp
                next unless /^<.*>|^\*/;  #remove information line
                next if /^<.*>\s!/;               #remove bot commands
                s/\*(.*)\s/<$1> / if /^\*/;  #replace *nick with <nick>
                print;
    }
}

__END__


The log files contain data of the following form:

[23/02/2005 19:20] =-= SnoopyD is now known as SnoopyDke
[23/02/2005 19:21] <SnoopyDke> in zen vel zekers als ze hem ni gestroopt hemme :p
[23/02/2005 19:21] <lieveke-> ej ma hebde da geleze van diene man die zijn ma zo had gestroopt ?
[23/02/2005 19:21] <lieveke-> en dan zo met da vel over hem rond liep ?
[23/02/2005 19:21] <lieveke-> iiiii
[23/02/2005 19:21] <lieveke-> :p
[23/02/2005 19:22] -->| nutty ([EMAIL PROTECTED]) has joined #chat2chat
[23/02/2005 19:23] -->| magali ([EMAIL PROTECTED]) has joined #chat2chat
[23/02/2005 19:23] <lieveke-> eh SnoopyDke :p
[23/02/2005 19:23] <lieveke-> hebde da geleze
[23/02/2005 19:23] <lieveke-> :p
[23/02/2005 19:23] <lieveke-> !sex Pietje
[23/02/2005 19:23] <Textbot> lieveke- sleurt Pietje eens mee de bosjes in om er donder en bliksem mee te maken...*rrrrrrrrrr*


Thanks for any help, H.

--
Hendrik Maryns

Interesting websites:
www.lieverleven.be      (I cooperate)
www.eu04.com            European Referendum Campaign
aouw.org                The Art Of Urban Warfare


-- 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