<?xml version="1.0" encoding="windows-1252"?>
<node id="990551" title="Re^2: regular expression for the address" created="2012-08-29 16:16:21" updated="2012-08-29 16:16:21">
<type id="11">
note</type>
<author id="590906">
linuxer</author>
<data>
<field name="doctext">
&lt;p&gt;What do you use that &lt;c&gt;eval&lt;/c&gt; for? Only for eliminating the parentheses? Bad idea, I think.&lt;/p&gt;

&lt;p&gt;Let's assume there is a list of strings from which the value of the second last field is wanted.&lt;/p&gt;
&lt;p&gt;If there is a bad data source, that &lt;c&gt;eval&lt;/c&gt; would execute bad stuff like &lt;c&gt;system("echo Hello World.")&lt;/c&gt; or even worse...

&lt;code&gt;
$ perl

use feature ":5.14";
use warnings FATAL =&gt; qw(all);
use strict;

my $var = &lt;&lt; 'END';
11,2222222,"xxxxxx'x xxxxxxx, xxxxxxxxx",sssss (aaa 111) 1111-a ,aaaaaaa aa ,aaaaaa, ,xxxxxxxx,dd/dd/dd,xx, system('echo bad command executed!!'),111111
END

say eval [split /,\s*/, $var]-&gt;[-2]

bad command executed!!
0
&lt;/code&gt;

If you want to remove the parentheses, you could use an tr///. For example:

&lt;code&gt;
use feature ":5.14";
use warnings FATAL =&gt; qw(all);
use strict;

my $var = &lt;&lt; 'END';
11,2222222,"xxxxxx'x xxxxxxx, xxxxxxxxx",sssss (aaa 111) 1111-a ,aaaaaaa aa
,aaaaaa, ,xxxxxxxx,dd/dd/dd,xx, (195.14) ,111111
END

my $interest = split /,\s*/, $var)[-2];
$interest    =~ tr/0-9.//cd;

say $interest;
&lt;/code&gt;
</field>
<field name="root_node">
990423</field>
<field name="parent_node">
990463</field>
</data>
</node>
