open IN, 'in.xml';
open OUT, '>temp.xml';
while (<IN>) {
s/\s*<\/NAME>/<\/NAME>/;
print OUT;
}
unlink 'in.xml';
rename 'temp.xml', 'in.xml';
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of
> Saxena, Saurabh
> Sent: Thursday, June 07, 2001 1:16 PM
> To: 'Perl2'; 'Perl1'
> Subject: Help on subctitution s///
>
>
>
> I have a XML file which looks like
> "...
> <NAME>Saurabh </NAME>
> .."
>
> I want to remove the whitespace in the TAG value. I am using
>
> while (<>)
> {
> s/\s*<\/NAME>/<\/NAME>/; -->This will replace the
> <whitespace></NAME> with </NAME>
> print 4_;
> }
>
> On the console it is showing the value as
>
> "...
> <NAME>Saurabh</NAME>
> .."
>
> but the file is not touched.
>
> Now is it possible by any method to replace the whitespace on the file
> itself. Like open the file then replace the <whitespace></NAME> with
> </NAME> on the file itself and then close the file
>
> regards
> Saurabh
>
>
>
>
>
>
>
> _______________________________________________
> ActivePerl mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/activeperl
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users