Arran Cudbard-Bell a.cudbardb at freeradius.org
Mon Nov 5 16:06:26 CET 2012

On 5 Nov 2012, at 14:28, Brian Candler <B.Candler at pobox.com> wrote:

> On Mon, Nov 05, 2012 at 09:41:37AM +0000, Arran Cudbard-Bell wrote:
>> Hmm not really equivalent because of the pre-escaping you'd need to do to
>> get the string into perl unmolested.  I challenge you to write a one liner
>> that'll work with an arbitrary length string from STDIN :P
>> Also, I hate Perl, with a passion. Any time I write some I feel dirty, and
>> it always comes out looking like someone vomited in the text editor.
> In Ruby:
> echo "foo\200bar" |
> ruby -e 'puts eval("\""+$stdin.read+"\"").unpack("H*").first'
> Or without eval:
> echo "foo\200bar" |
> ruby -e 'puts $stdin.read.gsub(/\\(\d\d\d)/) { $1.to_i(8).chr }.unpack("H*").first'

I guess that works if you have arbitrary amounts of memory :)


More information about the Freeradius-Devel mailing list