Solved

How to concatenate elements of an array in Perl?

Posted on 2011-09-27
1
377 Views
Last Modified: 2012-05-12
Hi,
Let's say, I have an array. I would like to concatenate the elements of this array (the elements can be all string or integer) with a comma between them. and then assign it to a variable.

Example:
@myArray = [temp1 temp 2 temp3]

$String = temp1,temp2, temp3

Open in new window


Thanks,


0
Comment
Question by:Tolgar
1 Comment
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 36711110
@myArray = qw(temp1 temp 2 temp3);
$string = join ',', @myArray;
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now