in reply to Removing duplicate line
I'd rewrite your logic slightly, so you modify the line in place, using $_ instead of several unnecessary temporary variables. I could write the code for you, but you have to understand the logic first.
Update: Here's a crack at better code:
There's no need to chomp or to carry extra things around. I'm not thrilled with the second regex, but I figure it's there for a reason. :)open (FILE, $filename) or die "Can't open $filename: $!"; while(<FILE>){ s/(a href=.+?\.)html/$1asp/g; s/(.*?)\<body\>(.*?)\<\/body\>/$2/i; print OUTFILE $_; } close(FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Removing duplicate line
by Chady (Priest) on Apr 30, 2001 at 23:48 UTC | |
|
Re: Re: Removing dublicate line
by Anonymous Monk on Apr 30, 2001 at 23:18 UTC |