Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
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

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
Node Status?
node history
Node Type: note [id://473112]
help
Chatterbox?
[marto]: good morning all, TCIF
[Corion]: Hi marto! Indeed, Crunchy be thanked!
choroba had a Christams party at work yesterday. Slow morning today...
[Corion]: I guess I should not read some discussions on HackerNews - the crowd there is weirdly different - "you have to stay current in tech" (by following all the latest JS trends) is a meme there, but it doesn't really match my experience

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2016-12-09 10:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (150 votes). Check out past polls.