Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

A perl riddle #1

by Anonymous Monk
on Apr 04, 2003 at 15:13 UTC ( [id://248079]=perlmeditation: print w/replies, xml ) Need Help??

More often than not, what do $1 and $! have in common?

Replies are listed 'Best First'.
Re: A perl riddle #1 (leftover)
by tye (Sage) on Apr 04, 2003 at 15:42 UTC

    Both should not be used unless you've just had a specific success/failure. So both often gets used in cases where they aren't guaranteed to be set to something appropriate (whatever they were set to previously).

                    - tye
Re: A perl riddle #1
by Mr. Muskrat (Canon) on Apr 04, 2003 at 15:16 UTC
    More often than not, neither one contains the value that you think they do...
Re: A perl riddle #1
by dga (Hermit) on Apr 04, 2003 at 17:11 UTC

    15 bits

    $1 00100100 00100011 $! 00100100 00100001
Re: A perl riddle #1
by jasonk (Parson) on Apr 04, 2003 at 15:18 UTC

    Other than the hard to find bugs I get when I hit the shift key at slightly the wrong moment?


    We're not surrounded, we're in a target-rich environment!
Re: A perl riddle #1
by dws (Chancellor) on Apr 04, 2003 at 17:29 UTC
    More often than not, what do $1 and $! have in common?

    Depending on what font you're viewing the code in, they have most of their pixels in common.

Re: A perl riddle #1
by cLive ;-) (Prior) on Apr 04, 2003 at 23:03 UTC
    $

    obvious really :)

    cLive ;-)

Re: A perl riddle #1
by Improv (Pilgrim) on Apr 04, 2003 at 15:27 UTC
    Well, they're both often empty...
Re: A perl riddle #1
by BrowserUk (Patriarch) on Apr 04, 2003 at 17:12 UTC

    One hundred cents?


    Examine what is said, not who speaks.
    1) When a distinguished but elderly scientist states that something is possible, he is almost certainly right. When he states that something is impossible, he is very probably wrong.
    2) The only way of discovering the limits of the possible is to venture a little way past them into the impossible
    3) Any sufficiently advanced technology is indistinguishable from magic.
    Arthur C. Clarke.

      Wouldn't it be $1.875, not $1.00? Following dga's logic: 15 bits. If you remember the "Shave and a haircut, 2 bits" ditty, then you know that one bit is 12.5 cents.

      12.5 cents * 15 bits = 187.5 cents = 1.875 dollars


      If the above content is missing any vital points or you feel that any of the information is misleading, incorrect or irrelevant, please feel free to downvote the post. At the same time, please reply to this node or /msg me to inform me as to what is wrong with the post, so that I may update the node to the best of my ability.

Re: A perl riddle #1
by mugwumpjism (Hermit) on Apr 06, 2003 at 15:50 UTC

    They're both used right after they are set.

    $h=$ENV{HOME};my@q=split/\n\n/,`cat $h/.quotes`;$s="$h/." ."signature";$t=`cat $s`;print$t,"\n",$q[rand($#q)],"\n";
Re: A perl riddle #1
by Anonymous Monk on Apr 05, 2003 at 07:17 UTC
    More often than not, what do $1 and $! have in common?

    They're both part of a uselessly open-ended question that's wasting my time?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-18 02:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found