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

Re: printing an array reference

by cmeyer (Pilgrim)
on Jul 18, 2005 at 20:26 UTC ( [id://475878]=note: print w/replies, xml ) Need Help??


in reply to printing an array reference

An arrayref is a scalar value, so you should store it in a scalar variable. There are several ways of dereferencing (turning it into an array) an arrayref. One of the easiest is to prepend the scalar variable that holds an arrayref with the array sigil ("@").

my $fieldNames = $sth->{ NAME_uc }; printf "%15s %12s %12s %22s %9s %5s $5s", @$fieldNames;

Take a read through some documentation, such as 'perldoc perlreftut', and the Q&A section here on Perlmonks (Here's a link to the references section).

-Colin.

WHITEPAGES.COM | INC

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2024-04-16 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found