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

Re: array join missing zero and space

by armstd (Friar)
on Jun 21, 2011 at 04:17 UTC ( #910666=note: print w/ replies, xml ) Need Help??


in reply to array join missing zero and space

'join' glues stuff together, with the string you specified as the glue.

You only have four spaces between your five fingers. Notice you don't get a trailing zero either...

To do what you want using a similar approach:

my @numbers = (4,7,11,14);
my $start='0 ';

print $start, join (" $start" , @numbers),"\n"; # notice the added space in the join string, but not the prefix string

--Dave


Comment on Re: array join missing zero and space

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2015-07-03 22:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls