Hi all,
I've just started to learn Perl and I'm trying to improve my knowledge.
I've written some code that will capture a string of text from between two points... specifically:
<name> string-to-capture </name>
I just want to capture "string-to-capture" without the tags. The following code does that:
if ( $_ =~ m/<name>/ )
{
$var1=$_;
$var1 =~ /<name>(.*?)<\/name>/i;
$var1 = $1;
$var1 =~ s/ //g;
print "$var1\n";
}
I imagine that there must be a better way of achieving this, could someone enlighten me please?