in reply to Creating data delimited by ASCII code 1 using perl

ASCII code 1 (binary1),

ASCII code 1:

$\ = "\n"; # output record separator print "\x01"; # hex print "\001"; # octal print "\cA"; # control char print pack "C",1; # byte with the lowest bit set

You can use any of them with join and split.

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'

Replies are listed 'Best First'.
Re^2: Creating data delimited by ASCII code 1 using perl (updated)
by haukex (Archbishop) on Jun 21, 2019 at 13:20 UTC

    TIMTOWTDI Party? ;-)

    print "\x{0001}"; print "\N{U+1}"; print "\N{START OF HEADING}"; print chr(1); print v1; print "x"^"y"; vec(my $x,0,8)=1; print $x;

    Update: "x"^"y" only works if the new bitwise feature is off; it could be turned on implicitly by the -E switch or a use 5.028; or higher (thanks for pointing this out, davido!). When the bitwise feature is on, one has to use the new ^. operator instead. Also, \N{START OF HEADING} requires charnames to be loaded explicitly on Perls before 5.16.