I'm developing a perl script.
This is my input string in a file new.txt:
<ID>1</ID>
<CLASS>One</CLASS>
<NAME>Saran</NAME>
This is my code which simply prints the three lines:
#!/usr/bin/perl
open(FILEHANDLE1,"new.txt") or die "Can't Open: $!\n";
while($line=<FILEHANDLE1>)
{
print "$line";
}
close FILEHANDLE1;
I need it to display only the contents between the tag. The output should be:
1 One Saran
How should I retrive the data between tags? Is there any way by using regular expressions?