Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Question on using format and write

by Tanalis (Curate)
on Dec 13, 2002 at 19:45 UTC ( [id://219723]=note: print w/replies, xml ) Need Help??


in reply to Question on using format and write

Not sure if this is the case from what you've got above, but all the variables in a format have to be in scope when you define the format, otherwise you'll simply get a load of blank lines output when you call write, even if the variables are in scope at the time of the write.

I've found the easiest way to ensure this is to define the format right after the write call - but it's not the most elegant way to do it.

Maybe it's something completely different .. not sure from what's there :)

Hope that helps a little ..
-- Foxcub

Replies are listed 'Best First'.
Re: Re: Question on using format and write
by vagnerr (Prior) on Dec 13, 2002 at 20:21 UTC
    Foxcub is correct. It looks like it is a scope problem. If you were to enforce warnings ( perl -w ) then you would get an error allong the lines of
    Use of uninitialized value in formline at ????.pl line ??.
    if you remove your line
    my ($cust, $d1, $d2, $c1, $c2);
    from the function, or perhaps put it before you define your format that should give you your output :-)

    _______________________________________________________
    Remember that amateurs built Noah's Ark. Professionals built the Titanic.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://219723]
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 2024-04-23 17:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found