#! perl use strict; use warnings; use Data::Dumper; my @lines = ; chomp(my $line = $lines[0]); chomp(my $string = Dumper("$line")); print "Dumper returns the string \"$string\"\n"; # Method 1: eval the string my $VAR1; eval $string; # Sets $VAR1 my $m = $VAR1 + 8; print "Method 1: $m\n"; # Method 2: extract the number if ($string =~ /'([-0-9.]+)'/) { my $value = $1; my $n = $value + 8; print "Method 2: $n\n"; } __DATA__ -39.9999400000 #### 23:27 >perl 730_SoPW.pl Dumper returns the string "$VAR1 = '-39.9999400000';" Method 1: -31.99994 Method 2: -31.99994 23:27 >