Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Problems printing contents of array

by kutsu (Priest)
on Jul 07, 2005 at 14:25 UTC ( #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


Comment on Re: Problems printing contents of array
Download Code
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
Node Status?
node history
Node Type: note [id://473112]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (9)
As of 2014-04-20 15:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (485 votes), past polls