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 imagine that there must be a better way of achieving this, could someone enlighten me please?if ( $_ =~ m/<name>/ ) { $var1=$_; $var1 =~ /<name>(.*?)<\/name>/i; $var1 = $1; $var1 =~ s/ //g; print "$var1\n"; }
In reply to Editing the contents of a variable by jmcmillan1873
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |