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?
What have you tried? What specific problems are you having?
It looks like you might want something like this:
But your question is so vague that it’s hard to be sure.