Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Why does this happen?

by merlyn (Sage)
on Apr 04, 2001 at 17:45 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-25 11:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found