Rob Dixon wrote:
>
> Meanwhile, how about a simpler solution like mine below, which I think is much
> more readable.
>
> HTH,
>
> Rob
>
>
>
>
> use strict;
> use warnings;
>
> my $source = 'XXXX';
> my $new = 'XXXX.new';
>
> open my $in, '<', $source or die $!;
> open my $out, '>', $new or die $!;
>
> my $t2 = '/resource-ref>';
>
> while (my $line = <$in>) {
>
> if ($line =~ /<resource-ref\s/ and $line =~ /DataSource_/) {
> my $line;
> do { $line = <$in> } until $line =~ /$t2/;
> }
> else {
> print $out $line;
> }
> }
Or, even better:
use strict;
use warnings;
my $source = 'XXXX';
my $new = 'XXXX.new';
open my $in, '<', $source or die $!;
open my $out, '>', $new or die $!;
my $t2 = '/resource-ref>';
while (<$in>) {
print unless /<resource-ref\s/ && /DataSource_/ ... /$t2/;
}
Rob
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/