Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Problems printing contents of array

by kutsu (Priest)
on Jul 07, 2005 at 14:25 UTC ( [id://473112]=note: print w/replies, xml ) Need Help??


in reply to Problems printing contents of array

Where do you define the array and assign to it because print "@s340Strings"; should work. Though if you want the contents of an array (an @array used in $scalar location will print the length of the array) then you want a for/foreach statement - like print for @s340Strings;

Update: Interesting I've never run into that before, that actually would help quite a bit. Thanks!

"Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

Replies are listed 'Best First'.
Re^2: Problems printing contents of array
by Roy Johnson (Monsignor) on Jul 07, 2005 at 14:48 UTC
    Putting an array in double quotes does not impose scalar context on the array; it does an implicit call to join using $" (default is a space) as the separator. Without the double quotes, print would print the contents using $, (default is empty string) as a separator.

    Caution: Contents may have been coded under pressure.
Re^2: Problems printing contents of array
by cchampion (Curate) on Jul 07, 2005 at 14:48 UTC
    an @array used in $scalar location will print the length of the array

    True, but this isn't the case.

    perl -le '@A=qw(a b c d); print "@A"' a b c d

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2024-04-24 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found