Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: how to debug an 'undef' that cannot be?

by greengaroo (Hermit)
on Mar 05, 2013 at 15:02 UTC ( #1021839=note: print w/replies, xml ) Need Help??

in reply to how to debug an 'undef' that cannot be?

Just to re-phrase what my fellow monks already pointed out, your problem is that you have two different $dev variable. When you use "my" in front of a variable, its scope becomes the current block. In the main program it's not a problem but in a while loop like you did, or any other kind of blocks, the variable will cease to exists at the end of said block, and will be recreated for each iteration, and it will never alter the content of the original variable defined outside of this block.

In clear: remove the "my" besides your $dev variable inside your while loop because it creates a separate variable, not related to the one you think you are using.

Good luck!

Testing never proves the absence of faults, it only shows their presence.

Replies are listed 'Best First'.
Re^2: how to debug an 'undef' that cannot be?
by perl-diddler (Chaplain) on Mar 05, 2013 at 20:39 UTC

    Data: smugbatch-006-2.1.3.x86_64.rpm smugbatch-006-2.4.1.x86_64.rpm Error: cannot stat, already deleted?) path=/Share/suse/distribution/12.1/repo +/oss/suse/test2/smugbatch-6-2.1.3.x86_64.rpm, dev=(undef)

    of course 'V' == "006"

    *sigh*...thanks all!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021839]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2018-06-18 06:48 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (109 votes). Check out past polls.