in reply to "pack" string read from command line
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; my $string = 'foo\x32\x33\x34bar'; $string =~ s/\\x([0-9a-f][0-9a-f]?)/chr hex $1/gie; say $string;
I wouldn't recommend eval.
Update: For full functionality, see String::Interpolate.
use String::Interpolate qw{ interpolate }; say interpolate($string);
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: "pack" string read from command line
by demoralizer (Beadle) on Nov 19, 2015 at 08:51 UTC | |
|
Re^2: "pack" string read from command line
by BillKSmith (Monsignor) on Nov 19, 2015 at 13:59 UTC |