Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: uninitialized $_ sneaks past warnings in grep/map block or expression

by merlyn (Sage)
on Sep 01, 2010 at 13:39 UTC ( [id://858336]=note: print w/replies, xml ) Need Help??


in reply to uninitialized $_ sneaks past warnings in grep/map block or expression

If you understand the rule that it's ok to copy undef to another variable, but not use it in an operation, all of these make perfect sense.

-- Randal L. Schwartz, Perl hacker

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

  • Comment on Re: uninitialized $_ sneaks past warnings in grep/map block or expression

Replies are listed 'Best First'.
Re^2: uninitialized $_ sneaks past warnings in grep/map block or expression
by ikegami (Patriarch) on Sep 01, 2010 at 14:05 UTC

    That explains the first, but undef isn't being copied in the map and grep statements. The OP doesn't know that map and grep set $_.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (4)
As of 2025-12-09 22:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (90 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.