in reply to parsing and evaluating a string
I know I could have made this neater by using $_, but he probably has the value in some variable.use strict; use warnings; my $str = 'char(123)+char(107)+char(112)+char(43)'; $str =~ tr/+/ /; $str =~ s/char\((\d+)\)/chr($1)/eg; print $str;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: parsing and evaluating a string
by johngg (Canon) on Apr 24, 2006 at 13:11 UTC |