Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Why does this happen?

by merlyn (Sage)
on Apr 04, 2001 at 17:45 UTC ( #69657=note: print w/replies, xml ) Need Help??


in reply to Why does this happen?

As for the error message, let's look at:
$^W = 1; $index = 0..2; # this is your problem - it's initially undef @matching = qw(disk duck deck); $result = $matching[$index]; # and here's your problem, $matching[unde +f]!
You've done the .. operator in a scalar context, making it the flip-flop range operator, but you've not read any input, so you're not at line 0 yet, so the value is undef (outside the range so far). This value will be true only when $. is between 0 and 2, inclusively.

-- Randal L. Schwartz, Perl hacker

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2022-01-16 20:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (49 votes). Check out past polls.

    Notices?