[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

print array

Posted on 2000-01-05
3
Medium Priority
?
183 Views
Last Modified: 2010-03-05
when my array is
$string="12345";
and i try to do
print "$string"
it prints nothing!
please help!
0
Comment
Question by:paulwhelan
3 Comments
 
LVL 2

Accepted Solution

by:
maxkir earned 40 total points
ID: 2325757
This code works:

$string = "12345";
print "$string";


This code works too:

my @strings;

$strings[0] = "1";
$strings[1] = "2";
$strings[2] = "3";

print join("", @strings);
0
 
LVL 1

Expert Comment

by:olthoff
ID: 2325766
print "@strings";

will print each element of the array separated by ,'s.  Your code doesn't indicate an array anywhere...
0
 
LVL 85

Expert Comment

by:ozo
ID: 2328294
$" defaults to ' ', not ','
  print @strings;
prints an array, but $string is a scalar, not an array, and
  print $string;
or
  print "$string";
will both print it
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In the distant past (last year) I hacked together a little toy that would allow a couple of Manager types to query, preview, and extract data from a number of MongoDB instances, to their tool of choice: Excel (http://dilbert.com/strips/comic/2007-08…
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…
Six Sigma Control Plans
Suggested Courses

640 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