in reply to Re: bin2hex converter
in thread bin2hex converter

No reason in particular. . . just trying it for fun. I was seeing how small I could get the code w/o using pack/unpack/modules

Replies are listed 'Best First'.
Re: bin2hex converter
by Abigail (Deacon) on Jun 11, 2001 at 00:12 UTC
    Oh, you wanted to play golf? Well, how about:
    s/(.{1,4})(?=(?:.{4})*$)/sprintf"%x",eval"0b$1"/eg;

    -- Abigail

      ($;,$_,$|,$\)=("Yoo*se\x7F*cd*Mcpk+"," "x17,1,"\r"); {vec($_=>1+$"=>$^F<<$^F)=ord($/^substr$;=>$"=int rand 16=>1); print&&select$,,$,,$,,$|/($|+tr/ //c);redo if y/ //>$^F**2};