Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: An obscure side effect?

by fokat (Deacon)
on Aug 04, 2003 at 23:51 UTC ( [id://280839]=note: print w/replies, xml ) Need Help??


in reply to An obscure side effect?

The result on my machine is slightly different:

bash-2.05a$ perl ./p 'BA' 'BA' 'A' 'A' bash-2.05a$ perl -v | egrep "This is perl" This is perl, v5.8.0 built for darwin bash-2.05a$ uname -a Darwin maclem 6.6 Darwin Kernel Version 6.6: Thu May 1 21:48:54 PDT 2 +003; root:xnu/xnu-344.34.obj~1/RELEASE_PPC Power Macintosh powerpc

Best regards

-lem, but some call me fokat

Replies are listed 'Best First'.
Re: Re: An obscure side effect?
by BrowserUk (Patriarch) on Aug 05, 2003 at 00:32 UTC

    Thanks. I think the difference is, as Abigail-II noted above, Win32 display drivers tend to represent the null (chr(0)) with a blank glyph on the screen whereas some (all?) *nix DDs 'display' a zero width glyph.

    P:\test>perl -l sub swab{ substr($_[0],$_[1],1)^=substr($_[0],$_[2],1)^=substr($_[0],$ +_[1],1)^=substr($_[0],$_[2],1); } $s='AB'; swab($s,0,1), print "'$s' : ", sprintf "%02x "x2, unpack 'C*',$s for 1 +..10; ^Z 'BA' : 42 41 ' B' : 00 42 ' ' : 00 00 ' ' : 00 00 ' ' : 00 00 ' ' : 00 00 ' ' : 00 00 ' ' : 00 00 ' ' : 00 00 ' ' : 00 00

    As you can see, although they show up as blank glyphs and therefore look like spaces, they are actually nulls.

    I think if you try this on your machine, you'll see that the contents of $s at each stage is the same, it's just the way the nulls get displayed that is different.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
    If I understand your problem, I can solve it! Of course, the same can be said for you.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://280839]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2024-04-20 09:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found