Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: Use of uninitialized value in formline?

by vrk (Chaplain)
on Mar 05, 2007 at 14:50 UTC ( #603220=note: print w/replies, xml ) Need Help??

in reply to Use of uninitialized value in formline?

I get warnings if I use -w. Unfortunately, I know little about formatted output, but do try this one:

my @a = qw/one/; $~ = "TEST"; write; format TEST = ---+++--- a: @* ~~ shift @a --------- .

Output with Perl 5.8.8:

Use of uninitialized value in formline at line 10. ---+++--- a: one ---------

My guess is that write wants to print one more line than there are data elements for. In your first example, this happens four times, because after the row

a: one two three

the array contains only two elements. write tries to shift three, and you get your first "uninitialized value" warning. Then write tries to print one line more, but the array is exhausted of elements, and you get thus three more warnings. In my shorter example, there is only one warning, because each line contains only one shift.

I have no clue whether this is a bug or a feature. I can remember using formatted output only once in my life, and that was years ago.

print "Just Another Perl Adept\n";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://603220]
[PriNet]: i think i found the problem, the "source" array that sets the individual key values isn't being cleared, it's keeping the previous values...
[atcroft]: PriNet: You might consider posting a small, self-contained snippet of that segment of your code, and see if someone else has a better idea.....
[atcroft]: PriNet: Ahhh... interesting.
[PriNet]: small would be a problem *heh*... the program reads all the lines from a pdf and converts the individual colum data to a seperate key/value pair... that's where the "previous" array from the pdf is not being cleared properly before reading the next pdf

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2017-06-28 03:16 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (619 votes). Check out past polls.