Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Brain Teaser

by Abigail (Deacon)
on Jun 11, 2001 at 00:19 UTC ( #87351=note: print w/ replies, xml ) Need Help??


in reply to Brain Teaser

It evaluates to 0 (or rather, false) only if the print fails - otherwise, it will evaluate to true (1 in practise). ;-)

perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * * / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / + / / % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % + %; BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n" +)}'

-- Abigail


Comment on Re: Brain Teaser
Download Code
Replies are listed 'Best First'.
Re: Re: Brain Teaser
by srawls (Friar) on Jun 11, 2001 at 00:26 UTC
    Tricky Abigail, but I meant what does \\///\\\// evaluate to (not print)--mabey I should have explained myself better. And again, that was a slip, I meant to say that it evaluates to 0 in integer context, in numeric context it evaluates to just under 1.

    The 15 year old, freshman programmer,
    Stephen Rawls

      Eh, perhaps on *your* system, but look at this:
      $ perl -le 'print \\///\\\//' 1.00000026558336981

      What the result of \\///\\\// is depends on how memory is alloced. It'll depend on your malloc (which could be the Perl supplied, or the system one, depending on how Perl was build); it'll hand out addresses using some algorithm, based on various factors. Don't assume that when you run it once on your system, it will be the same universally.

      -- Abigail

        Well, I ran it on DOS and UNIX, and it worked. I was hoping that since the memory was allocated closely it would be below 1; oh well--nothing can be 100% portable : )

        The 15 year old, freshman programmer,
        Stephen Rawls

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2015-07-08 06:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (94 votes), past polls